:root {
  /* The app's dark/light theme is entirely custom (this file's CSS
     variables + theme.js's [data-theme] attribute) - native form controls
     (date picker icon/popup, scrollbars, etc.) don't follow that on their
     own, they follow the `color-scheme` property instead. Without this,
     input[type="date"]'s calendar icon renders light-mode regardless of
     the app's actual theme - on mobile in dark mode it's effectively
     invisible against the dark background. Set on :root (not just .input)
     so every native control benefits, not only date inputs. Attribute
     selectors are live, so this also updates immediately when
     SinpeGuardTheme.toggle() flips [data-theme] - no extra JS needed. */
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #edf2ef;
  --surface-3: #e4ebe6;
  --text: #172019;
  --muted: #68736b;
  --line: #dbe3dd;
  --green: #1f9d45;
  --green-2: #39c760;
  --green-soft: #e2f6e7;
  --yellow: #a67600;
  --yellow-soft: #fff2c2;
  --red: #c63232;
  --red-soft: #fde4e4;
  --blue: #2676d9;
  --blue-soft: #dce8fb;
  --shadow: 0 14px 40px rgba(18, 32, 22, .08);
  --radius: 18px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1113;
  --surface: #14191c;
  --surface-2: #1b2226;
  --surface-3: #232c31;
  --text: #f3f6f4;
  --muted: #a5b0a8;
  --line: #2c363b;
  --green: #40d063;
  --green-2: #61e27c;
  --green-soft: #15371f;
  --yellow: #f1c94f;
  --yellow-soft: #3e3517;
  --red: #ff6262;
  --red-soft: #441f21;
  --blue: #66a8ff;
  --blue-soft: #1c2e42;
  --shadow: 0 18px 50px rgba(0, 0, 0, .30);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background .2s ease, color .2s ease;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.container { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
/* [hidden] and .btn's own display:inline-flex are equal specificity - without
   this, .btn's rule (declared after the UA stylesheet) wins the cascade and
   silently keeps a hidden .btn element visible. Affected both the
   REVIEW-row and Gmail-disconnect confirm/cancel buttons before this was
   added - found while screenshot-verifying the Gmail ERROR-state UI. */
.btn[hidden] { display: none; }
/* No app-wide rule existed for this at all before - found 2026-08-26 while
   screenshot-verifying merchant-admin's new credential-reveal ack-gate on a
   real device: the "Listo, ocultar" button was genuinely disabled
   (unclickable) but rendered fully green/active, indistinguishable from an
   enabled button - a merchant would have no visual cue they need to check
   the box first. Only scoped disabled styles existed before
   (.row-actions .btn:disabled, .table-action:disabled in merchant.css) -
   this is the one place .btn itself is styled, so it belongs here, not
   duplicated per-app. */
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: white; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); }
.muted { color: var(--muted); }
/* Real loading placeholder, not a hardcoded fake value or raw "Cargando"
   text shown while the real data is still in flight - a shared utility
   since both merchant-admin and platform-admin had the same flicker. */
.skeleton {
  display: inline-block; min-width: 2.4em; height: 1em; border-radius: 5px;
  background: var(--surface-2);
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}
@keyframes skeleton-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 800;
}
/* Same fix as .btn[hidden] above, same reason: .badge's own
   display:inline-flex (declared after the UA stylesheet) wins the cascade
   over the browser's default [hidden]{display:none} otherwise. Found
   2026-09-01 building subscription.html's status pill - the first place
   in this codebase that ever toggled `hidden` on a .badge element. */
.badge[hidden] { display: none; }
.accepted { color: var(--green); background: var(--green-soft); }
.review { color: var(--yellow); background: var(--yellow-soft); }
.rejected { color: var(--red); background: var(--red-soft); }
.pending { color: var(--muted); background: var(--surface-2); }
.received { color: var(--blue); background: var(--blue-soft); }

/* ===================================================================
   Shared data-table system (2026-09 table-design-system unification).
   Was byte-identical duplicated CSS in platform.css and merchant.css
   (platform-admin's own comment on its copy: "copied, not shared, to
   avoid any risk of touching platform-admin's live CSS" - both apps had
   already converged on the same values independently, this just removes
   the duplication risk without changing how either one looks). Every
   plain <table> in both Platform Admin and Merchant Admin inherits this
   automatically - no per-table class needed for the base look.
   =================================================================== */
.table-card { overflow: hidden; }
/* Wide tables (6+ columns, e.g. Consentimientos legales/Pagos/Uso) opt in
   via .wide-table on the .table-card: real gap found verifying this round
   - .table-card's base overflow:hidden means a wide table between the
   mobile breakpoint below and full desktop (roughly 800-1150px, tablet/
   narrow-laptop range) had no scroll affordance at all, silently clipping
   columns instead. Unconditional (not just inside a media query) so it's
   safe at every width; narrower tables stay overflow:hidden since they
   never need it. */
.wide-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
th {
  font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  font-weight: 750; background: var(--surface-2);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.table-action { border: 0; background: transparent; color: var(--green); font-weight: 800; cursor: pointer; }
.table-action:disabled { color: var(--muted); cursor: not-allowed; }
.table-action + .table-action { margin-left: 8px; }

/* Shared toolbar/pagination primitives - same filter/search/page-size
   row above every table in both apps. Values match platform.css's own
   2026-09-04 fix (was a single 420px column forcing 2-3 controls to
   stack awkwardly even on a wide screen) - min-width:0 on .input lets it
   shrink in tight spaces rather than forcing overflow. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 12px; margin-bottom: 14px; }
.toolbar .input { flex: 1 1 220px; min-width: 0; }
.toolbar .page-size-select { flex: 0 0 auto; width: auto; max-width: 100%; }
.toolbar .btn { flex: 0 0 auto; }
.toolbar-store-filter { display: flex; flex: none; gap: 8px; align-items: center; padding: 12px; margin-bottom: 14px; }
.toolbar-store-filter .page-size-select { flex: none; width: auto; max-width: 280px; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 12px; color: var(--muted); }
.pagination .btn { padding: 8px 14px; font-size: 12px; }
.page-actions { display: flex; justify-content: flex-end; margin-bottom: 14px; }

/* Mobile breakpoint (<=800px, unified from platform.css/merchant.css's
   own identical breakpoint). Horizontal-scroll fallback by default - a
   table narrower than min-width scrolls inside .table-card rather than
   squeezing columns unreadably (900px: platform-admin's tables tend to
   run wider/more columns; merchant-admin's narrower default is 640px,
   kept as the shared default since most tables in both apps fit it -
   .wide-table opts a specific table into the wider floor instead).
   Row-stacking is opt-in via .stack-mobile on the .table-card, for the
   handful of tables where a horizontal-scroll strip genuinely hides
   columns/actions (confirmed per-table via a real pixel audit when this
   was first built, not applied blanket-wide - see PART 3 of the table
   inventory for which tables currently opt in). Real <table>/<tr>/<td>
   markup stays either way (semantics/existing JS selectors intact) -
   .stack-mobile is presentation-only via CSS display overrides plus
   content:attr(data-label), not a second parallel card markup. */
@media (max-width: 800px) {
  .table-card { overflow-x: auto; }
  table { min-width: 640px; }
  .wide-table table { min-width: 900px; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .input, .toolbar .page-size-select { flex: 1 1 100%; max-width: none; }
  .toolbar-store-filter { flex-wrap: wrap; }
  .toolbar-store-filter .page-size-select { flex: 1; max-width: none; }

  .stack-mobile { overflow-x: visible; }
  .stack-mobile table { min-width: 0; }
  .stack-mobile table, .stack-mobile thead, .stack-mobile tbody,
  .stack-mobile tr, .stack-mobile th, .stack-mobile td { display: block; }
  .stack-mobile thead { position: absolute; left: -9999px; top: -9999px; }
  .stack-mobile tbody tr { border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; margin-bottom: 10px; }
  .stack-mobile tbody tr:last-child { margin-bottom: 0; }
  .stack-mobile td { border-bottom: 1px solid var(--line); padding: 10px 4px 10px 46%; position: relative; text-align: right; min-height: 20px; }
  .stack-mobile td:last-child { border-bottom: 0; }
  .stack-mobile td[data-label]::before {
    content: attr(data-label); position: absolute; left: 4px; width: 42%; text-align: left;
    font-weight: 750; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  }
  .stack-mobile td[data-label=""] { padding-left: 4px; text-align: left; }
  .stack-mobile td[data-label=""]::before { content: none; }
}
.theme-toggle {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
.input {
  width: 100%; padding: 11px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  outline: none;
}
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 13%, transparent); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 850; font-size: 20px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; background: var(--green-soft); color: var(--green);
  font-size: 20px;
}

/* Protected-page auth gate (2026-08-28 pilot-blocking fix): every
   merchant-admin/platform-admin page wraps its real content in .shell or
   .platform-shell and calls SinpeGuardApi.requireSession() at the top of
   init(). Before this, that wrapper rendered immediately on parse - full
   nav, header, and dashboard skeletons were visible for as long as
   requireSession()'s real network round trip (POST /v1/auth/refresh)
   took, before an invalid/expired/missing session redirected to login.
   visibility:hidden (not display:none) keeps normal layout/measurement
   working and is removed by requireSession() itself the instant a
   session is confirmed valid - never by a timer, so there is no
   arbitrary delay and no window where protected content is visible to
   an unauthenticated visitor. A failed check never reaches the reveal
   step at all; the page navigates to /login instead while still hidden. */
.shell, .platform-shell { visibility: hidden; }
