/* Private role-gated backoffice. The matching DOM is created only after /api/v1/auth/me authorizes the user. */
body.backoffice-open {
  overflow: hidden;
}

.backoffice-entry {
  appearance: none;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 15px 0 12px;
  border: 1px solid color-mix(in srgb, #b8fff2 28%, transparent);
  border-radius: 999px;
  color: #f4fffc;
  background:
    linear-gradient(135deg, rgba(9, 25, 35, .96), rgba(13, 73, 71, .93)),
    #0d3238;
  box-shadow: 0 10px 24px rgba(2, 28, 34, .2), inset 0 1px rgba(255, 255, 255, .12);
  font: 650 12px/1 Inter, system-ui, sans-serif;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.backoffice-entry:hover {
  transform: translateY(-1px);
  border-color: rgba(165, 255, 237, .62);
  box-shadow: 0 13px 30px rgba(2, 28, 34, .28), inset 0 1px rgba(255, 255, 255, .16);
}

.backoffice-entry:active {
  transform: translateY(0);
}

.backoffice-entry .material-symbols-outlined {
  font-size: 19px;
  color: #72ead4;
}

.backoffice-entry__access {
  padding: 3px 7px;
  border-radius: 999px;
  color: #b9fff1;
  background: rgba(114, 234, 212, .13);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.backoffice-root[hidden] {
  display: none !important;
}

.backoffice-root {
  --bo-ink: #f3f8f7;
  --bo-muted: #93a5a4;
  --bo-line: rgba(207, 231, 227, .12);
  --bo-panel: rgba(15, 27, 31, .88);
  --bo-panel-strong: #122127;
  --bo-accent: #5ee4c9;
  --bo-accent-2: #97a9ff;
  --bo-positive: #72e7ad;
  --bo-warning: #f3c875;
  --bo-negative: #ff8f9b;
  position: fixed;
  inset: 0;
  z-index: 12000;
  overflow: hidden;
  color: var(--bo-ink);
  background:
    radial-gradient(circle at 74% -10%, rgba(98, 102, 235, .2), transparent 35%),
    radial-gradient(circle at 8% 84%, rgba(32, 197, 164, .14), transparent 34%),
    linear-gradient(145deg, #071014 0%, #0b161b 47%, #0d181c 100%);
  font-family: Inter, system-ui, sans-serif;
  isolation: isolate;
}

.backoffice-root::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.backoffice-panel {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.backoffice-topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 3vw, 44px);
  border-bottom: 1px solid var(--bo-line);
  background: rgba(7, 16, 20, .72);
  backdrop-filter: blur(22px) saturate(125%);
}

.backoffice-brand,
.backoffice-topbar__actions,
.backoffice-role,
.backoffice-pagehead__meta,
.backoffice-section-title,
.backoffice-card__label,
.backoffice-privacy-note,
.backoffice-chart-legend,
.backoffice-empty {
  display: flex;
  align-items: center;
}

.backoffice-brand {
  min-width: 0;
  gap: 13px;
}

.backoffice-brand__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(94, 228, 201, .28);
  border-radius: 14px;
  color: #071713;
  background: linear-gradient(145deg, #8cf6e2, #3bc7b0);
  box-shadow: 0 10px 30px rgba(46, 205, 176, .18);
}

.backoffice-brand__mark .material-symbols-outlined {
  font-size: 23px;
  font-variation-settings: 'FILL' 1;
}

.backoffice-brand__eyebrow,
.backoffice-pagehead__eyebrow,
.backoffice-kpi__eyebrow {
  margin: 0 0 3px;
  color: var(--bo-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.backoffice-brand h1 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 650;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backoffice-topbar__actions {
  gap: 9px;
}

.backoffice-role {
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--bo-line);
  border-radius: 999px;
  color: #c7d3d1;
  background: rgba(255,255,255,.035);
  font-size: 11px;
  font-weight: 650;
}

.backoffice-role::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bo-accent);
  box-shadow: 0 0 0 4px rgba(94, 228, 201, .1);
  content: '';
}

.backoffice-icon-button,
.backoffice-admin-link,
.backoffice-refresh,
.backoffice-range button,
.backoffice-side-link {
  appearance: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.backoffice-icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--bo-line);
  border-radius: 12px;
  color: #b8c5c3;
  background: rgba(255,255,255,.035);
}

.backoffice-icon-button:hover,
.backoffice-admin-link:hover,
.backoffice-refresh:hover {
  color: #fff;
  border-color: rgba(94, 228, 201, .35);
  background: rgba(94, 228, 201, .09);
}

.backoffice-icon-button .material-symbols-outlined {
  font-size: 20px;
}

.backoffice-admin-link,
.backoffice-refresh {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--bo-line);
  border-radius: 12px;
  color: #cbd5d4;
  background: rgba(255,255,255,.035);
  font-size: 11px;
  font-weight: 650;
}

.backoffice-admin-link .material-symbols-outlined,
.backoffice-refresh .material-symbols-outlined {
  font-size: 17px;
}

.backoffice-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.backoffice-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 22px;
  border-right: 1px solid var(--bo-line);
  background: rgba(8, 18, 22, .5);
}

.backoffice-side-label {
  padding: 0 11px 9px;
  color: #657775;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.backoffice-side-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 0 12px;
  border-radius: 13px;
  color: #a4b3b1;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.backoffice-side-link[aria-current='page'] {
  color: #eafffa;
  background: linear-gradient(90deg, rgba(94, 228, 201, .14), rgba(94, 228, 201, .035));
  box-shadow: inset 2px 0 var(--bo-accent);
}

.backoffice-side-link .material-symbols-outlined {
  color: var(--bo-accent);
  font-size: 19px;
}

.backoffice-access-card {
  margin-top: auto;
  padding: 15px;
  border: 1px solid var(--bo-line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
}

.backoffice-access-card__icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 10px;
  color: var(--bo-accent);
  background: rgba(94, 228, 201, .09);
}

.backoffice-access-card__icon .material-symbols-outlined {
  font-size: 17px;
}

.backoffice-access-card strong,
.backoffice-access-card span {
  display: block;
}

.backoffice-access-card strong {
  margin-bottom: 5px;
  color: #dfe8e7;
  font-size: 11px;
}

.backoffice-access-card span {
  color: #758684;
  font-size: 10px;
  line-height: 1.55;
}

.backoffice-main {
  min-width: 0;
  overflow: auto;
  padding: clamp(24px, 3.2vw, 48px);
  overscroll-behavior: contain;
}

.backoffice-main__inner {
  width: min(1400px, 100%);
  margin: 0 auto;
}

.backoffice-pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 27px;
}

.backoffice-pagehead h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -.045em;
}

.backoffice-pagehead__meta {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.backoffice-updated {
  color: var(--bo-muted);
  font-size: 10px;
  white-space: nowrap;
}

.backoffice-range {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--bo-line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}

.backoffice-range button {
  min-width: 45px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: #7f918f;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}

.backoffice-range button[aria-pressed='true'] {
  color: #061512;
  background: var(--bo-accent);
  box-shadow: 0 5px 16px rgba(94, 228, 201, .17);
}

.backoffice-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.backoffice-kpi,
.backoffice-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--bo-line);
  background: linear-gradient(145deg, rgba(23, 40, 45, .9), rgba(12, 24, 29, .84));
  box-shadow: 0 22px 60px rgba(0,0,0,.14);
}

.backoffice-kpi {
  min-height: 146px;
  padding: 19px;
  border-radius: 19px;
}

.backoffice-kpi::after {
  content: '';
  position: absolute;
  right: -34px;
  bottom: -48px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--bo-kpi-glow, rgba(94, 228, 201, .08));
  filter: blur(2px);
}

.backoffice-kpi__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.backoffice-kpi__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--bo-kpi-color, var(--bo-accent));
  background: color-mix(in srgb, var(--bo-kpi-color, var(--bo-accent)) 10%, transparent);
}

.backoffice-kpi__icon .material-symbols-outlined {
  font-size: 19px;
}

.backoffice-kpi__value {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  color: #f6fbfa;
  font-size: clamp(21px, 2.2vw, 29px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.backoffice-kpi__value--money {
  font-size: clamp(18px, 1.8vw, 25px);
}

.backoffice-kpi__value span {
  display: block;
  margin-top: 5px;
  color: #91a19f;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0;
}

.backoffice-kpi__caption {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: #6f817f;
  font-size: 10px;
}

.backoffice-ledger-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.backoffice-card {
  border-radius: 20px;
}

.backoffice-ledger-card {
  min-height: 114px;
  padding: 18px 19px;
}

.backoffice-card__label {
  justify-content: space-between;
  gap: 10px;
  color: #8fa09e;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.backoffice-card__label .material-symbols-outlined {
  font-size: 18px;
  color: #657977;
}

.backoffice-ledger-card__value {
  margin-top: 16px;
  color: #e9f0ef;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.025em;
}

.backoffice-ledger-card__note {
  margin: 6px 0 0;
  color: #687a78;
  font-size: 10px;
  line-height: 1.45;
}

.backoffice-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.backoffice-chart-card,
.backoffice-audience-card,
.backoffice-transactions-card {
  padding: 20px;
}

.backoffice-section-title {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.backoffice-section-title h3 {
  margin: 0;
  color: #e9f0ef;
  font-size: 14px;
  font-weight: 600;
}

.backoffice-section-title p {
  margin: 4px 0 0;
  color: #6e817e;
  font-size: 10px;
}

.backoffice-chart-legend {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.backoffice-chart-legend span {
  color: #8c9d9a;
  font-size: 9px;
  font-weight: 650;
}

.backoffice-chart-legend i {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--legend-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--legend-color) 12%, transparent);
}

.backoffice-chart {
  min-height: 268px;
  position: relative;
}

.backoffice-chart svg {
  width: 100%;
  height: 268px;
  display: block;
  overflow: visible;
}

.backoffice-chart text {
  fill: #657674;
  font: 9px Inter, system-ui, sans-serif;
}

.backoffice-chart .grid-line {
  stroke: rgba(220, 242, 238, .075);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.backoffice-chart .series-line {
  fill: none;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.backoffice-chart .series-area {
  opacity: .12;
}

.backoffice-chart .series-dot {
  stroke: #102126;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.backoffice-audience-stats {
  display: grid;
  gap: 8px;
}

.backoffice-audience-stat {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(207, 231, 227, .08);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
}

.backoffice-audience-stat__icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--stat-color, var(--bo-accent));
  background: color-mix(in srgb, var(--stat-color, var(--bo-accent)) 10%, transparent);
}

.backoffice-audience-stat__icon .material-symbols-outlined {
  font-size: 18px;
}

.backoffice-audience-stat__label {
  color: #7d908d;
  font-size: 10px;
}

.backoffice-audience-stat__value {
  color: #edf5f3;
  font-size: 16px;
  font-weight: 600;
}

.backoffice-transactions-card {
  margin-bottom: 36px;
}

.backoffice-privacy-note {
  gap: 8px;
  color: #829390;
  font-size: 10px;
}

.backoffice-privacy-note .material-symbols-outlined {
  color: var(--bo-accent);
  font-size: 16px;
}

.backoffice-table-wrap {
  overflow: auto;
  border: 1px solid rgba(207, 231, 227, .08);
  border-radius: 14px;
}

.backoffice-table {
  width: 100%;
  min-width: 690px;
  border-collapse: collapse;
  table-layout: fixed;
}

.backoffice-table th,
.backoffice-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(207, 231, 227, .075);
  text-align: left;
  vertical-align: middle;
}

.backoffice-table th {
  color: #627572;
  background: rgba(255,255,255,.018);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.backoffice-table td {
  color: #aebcba;
  font-size: 10px;
}

.backoffice-table tr:last-child td {
  border-bottom: 0;
}

.backoffice-table__amount {
  color: #edf6f4 !important;
  font-size: 11px !important;
  font-weight: 650;
}

.backoffice-table__id {
  overflow: hidden;
  color: #7f918e !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backoffice-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #9cacaa;
  background: rgba(255,255,255,.045);
  font-size: 9px;
  font-weight: 650;
}

.backoffice-status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: '';
}

.backoffice-status--success { color: var(--bo-positive); background: rgba(114, 231, 173, .08); }
.backoffice-status--pending { color: var(--bo-warning); background: rgba(243, 200, 117, .08); }
.backoffice-status--failed { color: var(--bo-negative); background: rgba(255, 143, 155, .08); }

.backoffice-empty {
  min-height: 180px;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 28px;
  color: #71827f;
  text-align: center;
}

.backoffice-empty .material-symbols-outlined {
  font-size: 28px;
  color: #536663;
}

.backoffice-empty strong {
  color: #aab8b6;
  font-size: 12px;
}

.backoffice-empty span {
  max-width: 430px;
  font-size: 10px;
  line-height: 1.55;
}

.backoffice-error {
  display: grid;
  place-items: center;
  min-height: 440px;
  padding: 30px;
  text-align: center;
}

.backoffice-error__panel {
  max-width: 410px;
  padding: 30px;
  border: 1px solid rgba(255, 143, 155, .18);
  border-radius: 20px;
  background: rgba(255, 143, 155, .045);
}

.backoffice-error__panel .material-symbols-outlined {
  color: var(--bo-negative);
  font-size: 32px;
}

.backoffice-error__panel h3 {
  margin: 12px 0 7px;
  font-size: 16px;
}

.backoffice-error__panel p {
  margin: 0 0 18px;
  color: var(--bo-muted);
  font-size: 11px;
  line-height: 1.55;
}

.backoffice-skeleton {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  background: rgba(255,255,255,.055);
  border-radius: 7px;
}

.backoffice-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: backoffice-shimmer 1.45s infinite;
}

@keyframes backoffice-shimmer {
  to { transform: translateX(100%); }
}

.backoffice-entry:focus-visible,
.backoffice-root button:focus-visible {
  outline: 2px solid var(--bo-accent, #5ee4c9);
  outline-offset: 3px;
}

@media (max-width: 1100px) {
  .backoffice-layout { grid-template-columns: 82px minmax(0, 1fr); }
  .backoffice-sidebar { padding-inline: 13px; }
  .backoffice-side-label,
  .backoffice-side-link span:not(.material-symbols-outlined),
  .backoffice-access-card strong,
  .backoffice-access-card span { display: none; }
  .backoffice-side-link { justify-content: center; padding: 0; }
  .backoffice-access-card { display: grid; place-items: center; padding: 10px; }
  .backoffice-access-card__icon { margin: 0; }
  .backoffice-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .backoffice-topbar { min-height: 66px; padding-inline: 16px; }
  .backoffice-role span,
  .backoffice-admin-link span:not(.material-symbols-outlined) { display: none; }
  .backoffice-role { width: 34px; padding: 0; justify-content: center; }
  .backoffice-role::before { width: 7px; height: 7px; }
  .backoffice-admin-link { width: 38px; padding: 0; }
  .backoffice-layout { display: block; }
  .backoffice-sidebar { display: none; }
  .backoffice-main { height: 100%; padding: 24px 16px 42px; }
  .backoffice-pagehead { align-items: flex-start; flex-direction: column; gap: 14px; }
  .backoffice-pagehead__meta { width: 100%; justify-content: space-between; }
  .backoffice-analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .backoffice-entry { width: 40px; padding: 0; justify-content: center; }
  .backoffice-entry__label,
  .backoffice-entry__access { display: none; }
  .backoffice-brand__eyebrow { display: none; }
  .backoffice-brand__mark { width: 36px; height: 36px; border-radius: 12px; }
  .backoffice-brand h1 { font-size: 14px; }
  .backoffice-refresh span:not(.material-symbols-outlined),
  .backoffice-updated { display: none; }
  .backoffice-refresh { width: 38px; padding: 0; }
  .backoffice-kpis,
  .backoffice-ledger-grid { grid-template-columns: 1fr; }
  .backoffice-kpi { min-height: 126px; }
  .backoffice-section-title { align-items: flex-start; flex-direction: column; }
  .backoffice-chart-legend { justify-content: flex-start; }
  .backoffice-chart,
  .backoffice-chart svg { min-height: 220px; height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .backoffice-entry,
  .backoffice-skeleton::after { transition: none; animation: none; }
}
