/**
 * Admin shell: write-action disable styles + dark theme token overrides.
 * Loaded on portal and every business page.
 * Dark surface remaps: /theme/admin-dark-surfaces.css (linked after this file).
 */

/* ── Shared Pretendard (absolute /fonts so every page resolves the same files) ── */
@font-face {
  font-family: "Pretendard";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/Pretendard-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Pretendard";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/Pretendard-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "Pretendard";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/Pretendard-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "Pretendard";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/Pretendard-Bold.woff2") format("woff2");
}

/* Override broken page-local @font-face (missing .otf / variable) so UI stays sans */
html, body,
body *:not(script):not(style) {
  font-family: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", sans-serif !important;
}

/* ── Write actions: visible but disabled ── */
[data-admin-write-disabled],
button[data-admin-write-disabled],
a[data-admin-write-disabled],
[data-admin-write-disabled] > button {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(0.15);
}

input[data-admin-write-disabled],
textarea[data-admin-write-disabled],
select[data-admin-write-disabled] {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* Keep query chrome crisp */
button.rb-cmp-btn--primary:not([data-admin-write-disabled]),
button.rb-cmp-filterchip:not([data-admin-write-disabled]),
button.rb-cmp-refresh:not([data-admin-write-disabled]) {
  pointer-events: auto;
}

/* ── Theme switcher (mounted by i18n runtime) ── */
#admin-chrome-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10001;
  display: flex;
  gap: 6px;
  align-items: center;
}
#admin-lang-switcher,
#admin-theme-switcher {
  position: static;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font: 12px/1 ui-sans-serif, system-ui, sans-serif;
}
#admin-lang-switcher button,
#admin-theme-switcher button {
  border: 0;
  cursor: pointer;
  color: #e4e4e7;
  background: transparent;
  min-width: 32px;
  height: 28px;
  border-radius: 999px;
  padding: 0 8px;
}
#admin-lang-switcher button.is-on,
#admin-theme-switcher button.is-on {
  background: #fff;
  color: #18181b;
  font-weight: 700;
}
#admin-lang-switcher button:hover,
#admin-theme-switcher button:hover {
  color: #fff;
}

html[data-admin-theme="dark"] #admin-lang-switcher,
html[data-admin-theme="dark"] #admin-theme-switcher {
  background: rgba(39, 39, 42, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
html[data-admin-theme="dark"] #admin-lang-switcher button.is-on,
html[data-admin-theme="dark"] #admin-theme-switcher button.is-on {
  background: #fafafa;
  color: #18181b;
}

/* ── Dark theme: override Ruby design tokens ── */
html[data-admin-theme="dark"] {
  color-scheme: dark;
  --rb-primary: #9b8fd4;
  --rb-primary-hover: #b0a5e0;
  --rb-primary-active: #8678c4;
  --rb-primary-bg: #2a2640;
  --rb-primary-bg-hover: #342e52;
  --rb-primary-border: #5b4ea8;
  --rb-primary-text: #ddd6ff;
  /* Text on primary/purple fills — keep white (pages use this for hero/KPI labels). */
  --rb-on-primary: #ffffff;
  --rb-purple: #9b8fd4;
  --rb-purple-light: #3a3458;
  /* Accent text on dark surfaces (light mode uses #26215C on white). */
  --rb-purple-dark: #ddd6ff;
  --rb-purple-hover: #b0a5e0;
  /* Solid purple fills for hero/summary bands that still reference purple-dark as a fill in light CSS. */
  --rb-purple-fill: #3a3458;
  --rb-purple-fill-deep: #2a2640;

  --rb-bg-base: #0c0c0e;
  --rb-bg-layout: #121214;
  --rb-bg-container: #1a1a1e;
  --rb-bg-elevated: #222228;
  --rb-bg-spotlight: #2a2a32;
  --rb-bg-spotlight-hover: #34343e;
  --rb-bg-mask: rgba(0, 0, 0, 0.65);
  --rb-bg-blur: rgba(18, 18, 20, 0.82);
  --rb-bg-text-hover: rgba(155, 143, 212, 0.12);
  --rb-bg-text-active: rgba(155, 143, 212, 0.18);

  --rb-text-primary: #f4f4f5;
  --rb-text-secondary: #b4b4be;
  --rb-text-tertiary: #8b8b96;
  --rb-text-quaternary: #6e6e78;
  --rb-text-disabled: rgba(244, 244, 245, 0.35);
  --rb-text-on-primary: #ffffff;
  --rb-text-link: #b0a5e0;

  --rb-border: #3f3f46;
  --rb-border-secondary: #2e2e35;
  --rb-border-tertiary: #232329;
  --rb-border-light: #2e2e35;

  --rb-success: #34d399;
  --rb-success-dark: #6ee7b7;
  --rb-success-bg: #14301c;
  --rb-success-text: #86efac;
  --rb-success-border: #166534;
  --rb-warning-bg: #3a2a10;
  --rb-warning-text: #fdba74;
  --rb-warning-border: #9a3412;
  --rb-danger-bg: #3a1515;
  --rb-danger-text: #fca5a5;
  --rb-danger-border: #991b1b;
  --rb-error: #f87171;
  --rb-error-dark: #fca5a5;
  --rb-error-bg: #3a1515;
  --rb-error-text: #fca5a5;
  --rb-info: #38bdf8;
  --rb-info-dark: #7dd3fc;
  --rb-info-bg: #0f2433;
  --rb-info-text: #7dd3fc;
  --rb-info-border: #075985;
  --rb-warning-dark: #fdba74;
  --rb-warning: #fbbf24;

  --rb-cmp-bg: var(--rb-bg-container);
  --rb-cmp-bg-soft: var(--rb-bg-layout);
  --rb-cmp-text: var(--rb-text-primary);
  --rb-cmp-border: var(--rb-border);
  --rb-cmp-muted: var(--rb-text-tertiary);

  --rb-surface-2: #1c1c22;
  --rb-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --rb-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Hard-coded light surfaces that ignore tokens */
html[data-admin-theme="dark"] body,
html[data-admin-theme="dark"] #rb-root,
html[data-admin-theme="dark"] .rb-gr-root,
html[data-admin-theme="dark"] .rb-sr-root,
html[data-admin-theme="dark"] .rb-ml-root,
html[data-admin-theme="dark"] .rb-rt-root {
  background: var(--rb-bg-layout) !important;
  color: var(--rb-text-primary);
}

html[data-admin-theme="dark"] table,
html[data-admin-theme="dark"] th,
html[data-admin-theme="dark"] td,
html[data-admin-theme="dark"] .rb-cmp-table,
html[data-admin-theme="dark"] [class*="table"] {
  color: var(--rb-text-primary);
}

html[data-admin-theme="dark"] input,
html[data-admin-theme="dark"] textarea,
html[data-admin-theme="dark"] select {
  background: var(--rb-bg-elevated);
  color: var(--rb-text-primary);
  border-color: var(--rb-border);
}

html[data-admin-theme="dark"] .rb-cmp-btn--ghost,
html[data-admin-theme="dark"] button[class*="ghost"] {
  color: var(--rb-text-primary);
  border-color: var(--rb-border);
}

html[data-admin-theme="dark"] .rb-cmp-modal,
html[data-admin-theme="dark"] [class*="modal__panel"],
html[data-admin-theme="dark"] [class*="modal-panel"],
html[data-admin-theme="dark"] [class*="popover"],
html[data-admin-theme="dark"] [class*="dropdown"],
html[data-admin-theme="dark"] [class*="panel"],
html[data-admin-theme="dark"] [class*="card"],
html[data-admin-theme="dark"] [class*="toolbar"],
html[data-admin-theme="dark"] [class*="filterbar"],
html[data-admin-theme="dark"] [class*="thead"],
html[data-admin-theme="dark"] thead th {
  background: var(--rb-bg-container);
  color: var(--rb-text-primary);
  border-color: var(--rb-border);
}

html[data-admin-theme="dark"] tr:hover td,
html[data-admin-theme="dark"] [class*="__row"]:hover {
  background: var(--rb-bg-spotlight) !important;
}

/* Common hard-coded white surfaces in ref_html */
html[data-admin-theme="dark"] [style*="background:#fff"],
html[data-admin-theme="dark"] [style*="background: #fff"],
html[data-admin-theme="dark"] [style*="background:#FFF"],
html[data-admin-theme="dark"] [style*="background: #FFF"],
html[data-admin-theme="dark"] [style*="background:#ffffff"],
html[data-admin-theme="dark"] [style*="background: #ffffff"] {
  background: var(--rb-bg-container) !important;
  color: var(--rb-text-primary) !important;
}

html[data-admin-theme="dark"] [style*="background:#F5F5F7"],
html[data-admin-theme="dark"] [style*="background: #F5F5F7"],
html[data-admin-theme="dark"] [style*="background:#f5f5f7"],
html[data-admin-theme="dark"] [style*="background: #f5f5f7"] {
  background: var(--rb-bg-layout) !important;
}

html[data-admin-theme="dark"] #admin-toast {
  background: #27272a !important;
  color: #fafafa !important;
}

/* Portal */
html[data-admin-theme="dark"] body[data-admin-portal] {
  background: #121214;
  color: #f4f4f5;
}
html[data-admin-theme="dark"] body[data-admin-portal] header {
  background: #0c0c0e;
  color: #f8fafc;
}
html[data-admin-theme="dark"] body[data-admin-portal] h2 {
  color: #a1a1aa;
}
html[data-admin-theme="dark"] body[data-admin-portal] a.card {
  background: #1a1a1e;
  border-color: #3f3f46;
  color: #f4f4f5;
}
html[data-admin-theme="dark"] body[data-admin-portal] a.card:hover {
  border-color: #9b8fd4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
html[data-admin-theme="dark"] body[data-admin-portal] a.card .note {
  color: #a1a1aa;
}
html[data-admin-theme="dark"] body[data-admin-portal] .badge {
  background: #2a2640;
  color: #ddd6ff;
}
html[data-admin-theme="dark"] body[data-admin-portal] .badge.warn {
  background: #3a2a10;
  color: #fdba74;
}
html[data-admin-theme="dark"] body[data-admin-portal] .badge.mute {
  background: #27272a;
  color: #a1a1aa;
}

/* Hide Korean source UI until AdminI18n applies (zh/en). Set in <head> bootstrap. */
html.admin-i18n-pending body {
  visibility: hidden !important;
}

/* Hide newly opened calendars/dropdowns until the mutation walker translates them */
html[data-admin-lang="zh"] .rb-cmp-calpanel:not([data-i18n-done]),
html[data-admin-lang="zh"] [data-cal-panel]:not([data-i18n-done]),
html[data-admin-lang="zh"] .rb-gr-md-msel__panel:not([data-i18n-done]),
html[data-admin-lang="zh"] .rb-gr-md-daterange-dd__panel:not([data-i18n-done]),
html[data-admin-lang="en"] .rb-cmp-calpanel:not([data-i18n-done]),
html[data-admin-lang="en"] [data-cal-panel]:not([data-i18n-done]),
html[data-admin-lang="en"] .rb-gr-md-msel__panel:not([data-i18n-done]),
html[data-admin-lang="en"] .rb-gr-md-daterange-dd__panel:not([data-i18n-done]) {
  visibility: hidden !important;
}

/* ── Page loading overlay (tables / charts wait for live data) ── */
@keyframes admin-spin {
  to { transform: rotate(360deg); }
}

#admin-page-loading {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(250, 250, 250, 0.72);
  backdrop-filter: blur(2px);
  pointer-events: all;
}

html[data-admin-theme="dark"] #admin-page-loading {
  background: rgba(18, 18, 20, 0.72);
}

html.admin-page-loading #admin-page-loading {
  display: flex;
}

/* Keep top nav usable while content waits */
html.admin-page-loading #admin-shell-header,
html.admin-page-loading #admin-shell-menu,
html.admin-page-loading #admin-chrome-bar {
  z-index: 9600;
}

.admin-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(91, 78, 168, 0.18);
  border-top-color: #5b4ea8;
  animation: admin-spin 0.75s linear infinite;
}

.admin-page-loading__label {
  font: 13px/1.4 "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  color: #52525b;
  letter-spacing: 0.01em;
}

html[data-admin-theme="dark"] .admin-page-loading__label {
  color: #a1a1aa;
}

.admin-chart-loading,
.admin-table-loading {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  font: 13px/1.4 "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

.admin-chart-loading .admin-spinner,
.admin-table-loading .admin-spinner {
  width: 28px;
  height: 28px;
  border-width: 2.5px;
}

.admin-unsupported-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border: 1px solid #a1a1aa;
  border-radius: 50%;
  color: #71717a;
  background: #fff;
  font: 700 10px/1 system-ui, sans-serif;
  vertical-align: middle;
  cursor: help;
  flex: 0 0 15px;
}

.admin-unsupported-help::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 12000;
  left: 50%;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(280px, 72vw);
  padding: 7px 9px;
  border-radius: 6px;
  background: #18181b;
  color: #fff;
  font: 12px/1.45 "Pretendard", system-ui, sans-serif;
  white-space: normal;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.admin-unsupported-help:hover::after,
.admin-unsupported-help:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.admin-unsupported-help:focus-visible {
  outline: 2px solid #5b4ea8;
  outline-offset: 2px;
}

html[data-admin-theme="dark"] .admin-unsupported-help {
  border-color: #71717a;
  background: #27272a;
  color: #d4d4d8;
}

.admin-data-coverage {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-left: 3px solid #b26a00;
  background: #fff7e6;
  color: #713f12;
  font: 12px/1.5 "Pretendard", system-ui, sans-serif;
}

html[data-admin-theme="dark"] .admin-data-coverage {
  background: #33250d;
  color: #fde68a;
}

.admin-unsupported-panel {
  min-height: 220px;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #71717a;
  text-align: center;
}

.admin-unsupported-panel__value {
  font-size: 28px;
  line-height: 1;
}

.admin-unsupported-panel__title {
  color: #3f3f46;
  font-size: 14px;
  font-weight: 700;
}

.admin-unsupported-panel__text {
  font-size: 12px;
}

html[data-admin-theme="dark"] .admin-unsupported-panel__title {
  color: #e4e4e7;
}

.admin-data-surface {
  padding: 14px 0 24px;
}

.admin-data-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.admin-data-summary__item {
  padding: 12px 14px;
  border: 1px solid var(--rb-border-light, #e4e4e7);
  background: var(--rb-surface-1, #fff);
  border-radius: 6px;
}

.admin-data-summary__label {
  color: var(--rb-text-tertiary, #71717a);
  font-size: 11px;
}

.admin-data-summary__value {
  margin-top: 4px;
  color: var(--rb-text-primary, #18181b);
  font: 700 18px/1.25 ui-monospace, monospace;
}

.admin-data-table-wrap {
  overflow: auto;
  border: 1px solid var(--rb-border-light, #e4e4e7);
  border-radius: 6px;
  background: var(--rb-surface-1, #fff);
}

.admin-data-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-data-table th,
.admin-data-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--rb-border-light, #e4e4e7);
  color: var(--rb-text-primary, #18181b);
  text-align: left;
  white-space: nowrap;
}

.admin-data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--rb-surface-2, #f4f4f5);
  color: var(--rb-text-secondary, #52525b);
  font-weight: 700;
}

.admin-data-table .is-num {
  text-align: right;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.admin-data-empty {
  padding: 44px 16px;
  color: var(--rb-text-tertiary, #71717a);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 640px) {
  .admin-data-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-data-summary__value { font-size: 15px; }
  .admin-unsupported-help::after {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
    max-width: none;
    transform: translateY(3px);
  }
  .admin-unsupported-help:hover::after,
  .admin-unsupported-help:focus-visible::after {
    transform: translateY(0);
  }
}

/* API-driven admin pages */
.admin-page-host {
  box-sizing: border-box;
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 18px 20px 32px;
}

.admin-page-heading,
.admin-live-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-page-heading h1,
.admin-live-toolbar h1 {
  margin: 0;
  color: var(--rb-text-primary, #18181b);
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.admin-page-heading p,
.admin-live-toolbar p {
  margin: 3px 0 0;
  color: var(--rb-text-tertiary, #71717a);
  font-size: 12px;
}

.admin-live-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-live-toolbar__actions label,
.admin-live-search {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--rb-text-secondary, #52525b);
  font-size: 12px;
}

.admin-live-toolbar select,
.admin-live-search input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--rb-border-light, #d4d4d8);
  border-radius: 6px;
  background: var(--rb-surface-1, #fff);
  color: var(--rb-text-primary, #18181b);
  font: inherit;
}

.admin-live-search input { width: min(300px, 48vw); }

.admin-icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--rb-border-light, #d4d4d8);
  border-radius: 6px;
  background: var(--rb-surface-1, #fff);
  color: var(--rb-text-primary, #18181b);
  font: 700 17px/1 system-ui, sans-serif;
  cursor: pointer;
}

.admin-icon-button:hover { background: var(--rb-surface-2, #f4f4f5); }
.admin-icon-button:disabled { cursor: wait; opacity: 0.55; }

.admin-command-button,
.admin-data-pager button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--rb-purple, #5b4ea8);
  border-radius: 6px;
  background: var(--rb-purple, #5b4ea8);
  color: #fff;
  font: 600 12px/1 system-ui, sans-serif;
  cursor: pointer;
}

.admin-data-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 0;
  color: var(--rb-text-tertiary, #71717a);
  font-size: 12px;
}

.admin-data-pager > div { display: flex; gap: 6px; }
.admin-data-pager button:disabled { opacity: 0.42; cursor: default; }

.admin-data-link {
  color: var(--rb-purple, #5b4ea8);
  font-weight: 600;
  text-decoration: none;
}

.admin-data-link:hover { text-decoration: underline; }

.admin-data-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--rb-border-light, #d4d4d8);
  border-radius: 999px;
  background: var(--rb-surface-2, #f4f4f5);
  color: var(--rb-text-secondary, #52525b);
  font-size: 11px;
  font-weight: 700;
}

.admin-data-status[data-tone="pending"] {
  border-color: #d6a646;
  background: #fff8e7;
  color: #7a4b00;
}

.admin-data-status[data-tone="success"] {
  border-color: #70b995;
  background: #ecf9f1;
  color: #12623a;
}

.admin-data-status[data-tone="danger"] {
  border-color: #e29a9a;
  background: #fff1f1;
  color: #9d2525;
}

html[data-admin-theme="dark"] .admin-data-status[data-tone="pending"] {
  border-color: #8a661f;
  background: #33250d;
  color: #fde68a;
}

html[data-admin-theme="dark"] .admin-data-status[data-tone="success"] {
  border-color: #287451;
  background: #102c20;
  color: #86efac;
}

html[data-admin-theme="dark"] .admin-data-status[data-tone="danger"] {
  border-color: #8d4141;
  background: #371919;
  color: #fca5a5;
}

.admin-progress-cell {
  min-width: 150px;
  display: grid;
  gap: 5px;
  color: var(--rb-text-primary, #18181b);
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.admin-progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--rb-surface-3, #e4e4e7);
}

.admin-progress-track > span {
  display: block;
  height: 100%;
  background: #287451;
}

.admin-signup-table { min-width: 2400px; }
.admin-rolling-table { min-width: 2200px; }
.admin-money-table { min-width: 1500px; }
.admin-revenue-table { min-width: 2400px; }
.admin-analysis-table { min-width: 2200px; }

.admin-detail-heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
}

.admin-segmented-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 3px;
  margin: 4px 0 14px;
  border: 1px solid var(--rb-border-light, #e4e4e7);
  border-radius: 6px;
  background: var(--rb-surface-2, #f4f4f5);
}

.admin-segmented-tabs > button {
  min-width: max-content;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--rb-text-secondary, #52525b);
  font: 600 12px/1 system-ui, sans-serif;
  cursor: pointer;
}

.admin-segmented-tabs > button.is-active {
  background: var(--rb-surface-1, #fff);
  color: var(--rb-purple, #5b4ea8);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.admin-inline-tabs {
  width: max-content;
  max-width: 100%;
  margin: 0;
}

.admin-detail-panel { min-height: 280px; }

.admin-detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.admin-detail-section {
  min-width: 0;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--rb-border-light, #e4e4e7);
}

.admin-detail-section h2 {
  margin: 0 0 10px;
  color: var(--rb-text-primary, #18181b);
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0;
}

.admin-detail-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--rb-border-light, #e4e4e7);
}

.admin-detail-fields > div {
  min-width: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--rb-border-light, #e4e4e7);
}

.admin-detail-fields > div:nth-child(odd) { border-right: 1px solid var(--rb-border-light, #e4e4e7); }
.admin-detail-fields > div.is-wide { grid-column: 1 / -1; border-right: 0; }
.admin-detail-fields dt { color: var(--rb-text-tertiary, #71717a); font-size: 11px; }
.admin-detail-fields dd { overflow-wrap: anywhere; margin: 4px 0 0; color: var(--rb-text-primary, #18181b); font-size: 12px; }

.admin-dashboard-section {
  margin-top: 22px;
  padding-top: 4px;
}

.admin-dashboard-section h2 {
  margin: 0 0 9px;
  color: var(--rb-text-primary, #18181b);
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0;
}

@media (max-width: 760px) {
  .admin-page-host { padding: 12px 10px 24px; }
  .admin-page-heading,
  .admin-live-toolbar { align-items: flex-start; }
  .admin-live-toolbar { flex-wrap: wrap; }
  .admin-live-toolbar__actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .admin-live-toolbar__actions label { flex: 1 1 130px; }
  .admin-live-toolbar__actions select { width: 100%; }
  .admin-live-search { width: 100%; }
  .admin-live-search input { width: 100%; flex: 1; }
  .admin-detail-layout { grid-template-columns: 1fr; }
  .admin-detail-fields { grid-template-columns: 1fr; }
  .admin-detail-fields > div:nth-child(odd) { border-right: 0; }
  .admin-detail-fields > div.is-wide { grid-column: auto; }
}

/* Partner page keeps the original hierarchy workspace while using live API data. */
body.admin-has-shell .admin-partner-live .rb-pl {
  height: calc(100vh - var(--admin-header-h, 44px));
}

.admin-partner-live .rb-pl-toolbar {
  flex-wrap: wrap;
}

.admin-partner-live .rb-pl-toolbar__kpis {
  flex: 1 1 100%;
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.admin-partner-live #pl-refresh {
  margin-left: auto;
}

.admin-partner-live .rb-pl-th .admin-unsupported-help,
.admin-partner-live .rb-pl-tbkpi__k .admin-unsupported-help {
  vertical-align: middle;
}

.admin-partner-live .rb-pl-detail__page-note {
  color: var(--rb-text-tertiary, #71717a);
  font-size: 11px;
  line-height: 1.4;
}

.admin-partner-live .rb-pl-member-pager {
  flex: 0 0 auto;
  padding: 8px 0 0;
}

.admin-partner-live .rb-pl-member-pager button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

.admin-partner-live .rb-pl-mtbl-wrap {
  max-width: 100%;
  overflow: auto;
}

@media (max-width: 900px) {
  body.admin-has-shell .admin-partner-live .rb-pl {
    height: auto;
    min-height: calc(100vh - var(--admin-header-h, 44px));
    overflow: visible;
    flex-direction: column;
  }

  .admin-partner-live .rb-pl-rail {
    width: 100%;
    height: 210px;
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--rb-border-light, #e4e4e7);
  }

  .admin-partner-live .rb-pl-content,
  .admin-partner-live .rb-pl-body,
  .admin-partner-live .rb-pl-main {
    min-height: 680px;
    overflow: visible;
  }

  .admin-partner-live .rb-pl-toolbar__kpis {
    flex: 1 1 100%;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .admin-partner-live #pl-refresh {
    margin-left: 0;
  }

  .admin-partner-live .rb-pl-tree-wrap,
  .admin-partner-live .rb-pl-tree-wrap.is-mopen {
    grid-template-columns: minmax(0, 1fr) !important;
    min-height: 620px;
  }

  .admin-partner-live .rb-pl-tree-wrap.is-mopen .rb-pl-col--list {
    display: none;
  }

  .admin-partner-live .rb-pl-tree-wrap.is-mopen .rb-pl-col--members {
    display: flex;
  }
}
