:root {
  --admin-bg: #f5f5f7;
  --admin-surface: #ffffff;
  --admin-surface-soft: #f0f1f3;
  --admin-surface-strong: #e7e9ed;
  --admin-ink: #1d1d1f;
  --admin-muted: #6e6e73;
  --admin-soft: #8a8a8f;
  --admin-line: rgba(29, 29, 31, 0.1);
  --admin-line-strong: rgba(29, 29, 31, 0.17);
  --admin-primary: #0071e3;
  --admin-primary-hover: #0066cc;
  --admin-primary-soft: #e8f2ff;
  --admin-success: #248a3d;
  --admin-success-soft: #eaf7ed;
  --admin-warning: #a85d00;
  --admin-warning-soft: #fff4df;
  --admin-danger: #d70015;
  --admin-danger-soft: #ffebed;
  --admin-teal: #008c95;
  --admin-teal-soft: #e3f6f7;
  --admin-sidebar-width: 244px;
  --admin-radius: 8px;
  --admin-safe-top: env(safe-area-inset-top, 0px);
  --admin-safe-right: env(safe-area-inset-right, 0px);
  --admin-safe-bottom: env(safe-area-inset-bottom, 0px);
  --admin-safe-left: env(safe-area-inset-left, 0px);
  --admin-shadow-float: 0 18px 54px rgba(29, 29, 31, 0.12);
}

html.dark {
  --admin-bg: #000000;
  --admin-surface: #1c1c1e;
  --admin-surface-soft: #28282b;
  --admin-surface-strong: #343438;
  --admin-ink: #f5f5f7;
  --admin-muted: #a1a1a6;
  --admin-soft: #77777c;
  --admin-line: rgba(255, 255, 255, 0.1);
  --admin-line-strong: rgba(255, 255, 255, 0.18);
  --admin-primary: #2997ff;
  --admin-primary-hover: #53a9ff;
  --admin-primary-soft: #102c45;
  --admin-success: #55c66a;
  --admin-success-soft: #15361e;
  --admin-warning: #f2a33b;
  --admin-warning-soft: #3d2b12;
  --admin-danger: #ff6961;
  --admin-danger-soft: #401b1e;
  --admin-teal: #54ced3;
  --admin-teal-soft: #123537;
  --admin-shadow-float: 0 22px 64px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.market-admin {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--admin-ink) !important;
  background: var(--admin-bg) !important;
  font-family: "FogAct Admin CJK", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "FogAct CJK", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.market-admin button,
body.market-admin input,
body.market-admin select,
body.market-admin textarea {
  font-family: inherit;
  letter-spacing: 0;
}

body.market-admin button,
body.market-admin a,
body.market-admin select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body.market-admin a {
  color: inherit;
}

body.market-admin:has(#modal-root .modal-backdrop) {
  overflow: hidden !important;
}

body.market-admin button:focus-visible,
body.market-admin a:focus-visible,
body.market-admin input:focus-visible,
body.market-admin select:focus-visible,
body.market-admin textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--admin-primary) 34%, transparent) !important;
  outline-offset: 2px;
}

body.market-admin .rounded-3xl,
body.market-admin .rounded-2xl,
body.market-admin .rounded-xl {
  border-radius: var(--admin-radius) !important;
}

body.market-admin .rounded-lg {
  border-radius: 6px !important;
}

body.market-admin .bg-surface,
body.market-admin .bg-background {
  background-color: var(--admin-bg) !important;
}

body.market-admin .bg-surface-container-lowest {
  background-color: var(--admin-surface) !important;
}

body.market-admin .bg-surface-container-low {
  background-color: var(--admin-surface-soft) !important;
}

body.market-admin .bg-surface-container,
body.market-admin .bg-surface-container-high,
body.market-admin .bg-surface-container-highest {
  background-color: var(--admin-surface-strong) !important;
}

body.market-admin .text-on-surface,
body.market-admin .text-on-background {
  color: var(--admin-ink) !important;
}

body.market-admin .text-on-surface-variant {
  color: var(--admin-muted) !important;
}

body.market-admin .border-outline,
body.market-admin .border-outline-variant,
body.market-admin [class*="border-outline-variant"] {
  border-color: var(--admin-line) !important;
}

body.market-admin .bg-primary {
  background-color: var(--admin-primary) !important;
}

body.market-admin .text-primary {
  color: var(--admin-primary) !important;
}

body.market-admin .text-error {
  color: var(--admin-danger) !important;
}

body.market-admin .bg-green-50,
body.market-admin .bg-emerald-50 {
  color: var(--admin-success) !important;
  background: var(--admin-success-soft) !important;
}

body.market-admin .text-green-700,
body.market-admin .text-green-800,
body.market-admin .text-emerald-700 {
  color: var(--admin-success) !important;
}

body.market-admin .bg-amber-50,
body.market-admin .bg-warning-container {
  color: var(--admin-warning) !important;
  background: var(--admin-warning-soft) !important;
}

body.market-admin .text-amber-700,
body.market-admin .text-warning {
  color: var(--admin-warning) !important;
}

body.market-admin .bg-error-container {
  color: var(--admin-danger) !important;
  background: var(--admin-danger-soft) !important;
}

body.market-admin .text-on-error-container {
  color: var(--admin-danger) !important;
}

#app-container {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.material-symbols-outlined {
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 430, "GRAD" 0, "opsz" 24;
}

/* Login */
.market-admin .admin-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: max(28px, var(--admin-safe-top)) max(28px, var(--admin-safe-right)) max(28px, var(--admin-safe-bottom)) max(28px, var(--admin-safe-left));
  background: var(--admin-bg) !important;
  background-image: none !important;
}

.admin-login-home {
  position: fixed;
  top: calc(22px + var(--admin-safe-top));
  left: calc(24px + var(--admin-safe-left));
  z-index: 2;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  color: var(--admin-muted) !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.admin-login-home .material-symbols-outlined {
  font-size: 18px;
  transform: rotate(180deg);
}

.admin-login-home:hover {
  color: var(--admin-ink) !important;
}

.admin-login-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  width: min(860px, calc(100vw - 56px - var(--admin-safe-left) - var(--admin-safe-right)));
  min-height: 510px;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow-float);
}

.admin-login-brand-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 42px;
  color: #ffffff;
  background: #17181c;
}

.admin-login-wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
}

.admin-login-wordmark strong {
  font-weight: 700;
}

.admin-login-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 7px;
  color: #17181c;
  background: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.admin-login-brand-copy {
  margin: auto 0;
}

.admin-login-brand-copy > span,
.admin-login-kicker {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.admin-login-brand-copy h1 {
  margin: 8px 0 0;
  font-size: 42px;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: 0;
}

.admin-login-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.admin-login-status i,
.admin-page-live i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #32d06f;
}

.admin-login-form-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  background: var(--admin-surface);
}

.admin-login-form-panel header {
  margin-bottom: 34px;
}

.admin-login-form-panel .admin-login-kicker {
  color: var(--admin-primary);
}

.admin-login-form-panel h2 {
  margin: 8px 0 0;
  color: var(--admin-ink);
  font-size: 27px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0;
}

.admin-login-field {
  display: grid;
  gap: 9px;
}

.admin-login-field label {
  color: var(--admin-ink);
  font-size: 13px;
  font-weight: 600;
}

.market-admin .admin-login-field input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px !important;
  border: 1px solid var(--admin-line-strong) !important;
  border-radius: 7px !important;
  color: var(--admin-ink) !important;
  background: var(--admin-surface) !important;
  box-shadow: none !important;
  font-size: 16px !important;
}

.market-admin .admin-login-field input:focus {
  border-color: var(--admin-primary) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--admin-primary) 13%, transparent) !important;
}

.market-admin #login-submit {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 16px;
  border: 0;
  border-radius: 7px !important;
  color: #ffffff !important;
  background: var(--admin-primary) !important;
  box-shadow: none !important;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.market-admin #login-submit:hover {
  background: var(--admin-primary-hover) !important;
}

.market-admin #login-submit .material-symbols-outlined {
  font-size: 18px;
}

.market-admin #login-alert {
  border: 1px solid color-mix(in srgb, var(--admin-danger) 24%, transparent) !important;
  border-radius: 7px !important;
  color: var(--admin-danger) !important;
  background: var(--admin-danger-soft) !important;
}

/* Shell */
.market-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #ffffff;
  font-weight: 800;
}

#admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--admin-sidebar-width) !important;
  height: 100vh !important;
  height: 100dvh !important;
  flex-direction: column;
  padding: calc(20px + var(--admin-safe-top)) 14px calc(18px + var(--admin-safe-bottom)) max(14px, var(--admin-safe-left)) !important;
  border: 0 !important;
  border-right: 1px solid var(--admin-line) !important;
  border-radius: 0 !important;
  background: color-mix(in srgb, var(--admin-surface) 94%, var(--admin-bg)) !important;
  box-shadow: none !important;
}

.admin-sidebar-brand {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 8px;
}

.admin-sidebar-brand .market-logo {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: #ffffff;
  background: #1d1d1f;
  font-size: 14px;
}

html.dark .admin-sidebar-brand .market-logo {
  color: #1d1d1f;
  background: #ffffff;
}

.admin-sidebar-brand-title,
.admin-sidebar-brand-subtitle {
  display: block;
}

.admin-sidebar-brand-title {
  color: var(--admin-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
}

.admin-sidebar-brand-subtitle {
  margin-top: 3px;
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 500;
}

#admin-sidebar nav {
  min-height: 0;
}

#admin-sidebar .nav-section {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.admin-nav-label {
  margin: 18px 10px 7px;
  color: var(--admin-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

#admin-sidebar .nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px !important;
  margin: 3px 0;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 7px !important;
  color: var(--admin-muted) !important;
  background: transparent !important;
  box-shadow: none !important;
  text-decoration: none;
  font-size: 14px;
  transition: color 140ms ease, background-color 140ms ease;
}

#admin-sidebar .nav-item .material-symbols-outlined {
  font-size: 20px;
}

#admin-sidebar .nav-item:hover {
  color: var(--admin-ink) !important;
  background: var(--admin-surface-soft) !important;
}

#admin-sidebar .nav-item.active,
#admin-sidebar .nav-item.bg-surface-container-lowest {
  color: #ffffff !important;
  background: #1d1d1f !important;
}

html.dark #admin-sidebar .nav-item.active,
html.dark #admin-sidebar .nav-item.bg-surface-container-lowest {
  color: #1d1d1f !important;
  background: #ffffff !important;
}

#admin-sidebar .nav-item::before {
  display: none !important;
}

.admin-sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 16px 8px 2px;
  border-top: 1px solid var(--admin-line);
}

.admin-sidebar-account-avatar {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--admin-primary);
  background: var(--admin-primary-soft);
  font-size: 11px;
  font-weight: 700;
}

.market-admin .admin-sidebar-account .text-on-surface {
  font-weight: 650 !important;
}

.market-admin .admin-content {
  width: calc(100% - var(--admin-sidebar-width));
  height: 100vh !important;
  height: 100dvh !important;
  margin-left: var(--admin-sidebar-width) !important;
  overflow: hidden;
}

.market-admin .admin-header {
  z-index: 30;
  width: 100% !important;
  min-height: calc(70px + var(--admin-safe-top)) !important;
  height: calc(70px + var(--admin-safe-top)) !important;
  padding: calc(11px + var(--admin-safe-top)) max(24px, var(--admin-safe-right)) 11px 28px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--admin-line) !important;
  border-radius: 0 !important;
  background: color-mix(in srgb, var(--admin-surface) 88%, transparent) !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.admin-header-row,
.admin-header-left,
.admin-header-right,
.admin-page-heading {
  display: flex;
  min-width: 0;
  align-items: center;
}

.admin-header-row {
  min-height: 48px;
  justify-content: space-between;
}

.admin-header-left {
  gap: 12px;
}

.admin-header-right {
  gap: 6px;
}

.admin-page-heading {
  gap: 10px;
}

#page-title {
  min-width: max-content;
  margin: 0;
  color: var(--admin-ink);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0;
}

.admin-page-live {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  color: var(--admin-muted);
  background: var(--admin-surface);
  font-size: 10px;
  font-weight: 600;
}

.admin-mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  color: var(--admin-muted);
  background: var(--admin-surface);
}

.admin-service-switch {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface-soft);
}

.admin-service-switch[hidden] {
  display: none !important;
}

.admin-service-switch button {
  min-width: 62px;
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px !important;
  color: var(--admin-muted);
  background: transparent;
  box-shadow: none !important;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.admin-service-switch button:hover {
  color: var(--admin-ink);
}

.admin-service-switch button[aria-pressed="true"],
.admin-service-switch button.is-active {
  color: var(--admin-ink);
  background: var(--admin-surface);
  box-shadow: 0 1px 4px rgba(29, 29, 31, 0.1) !important;
}

.admin-search-wrap {
  position: relative;
  width: 236px;
}

.market-admin .admin-search-wrap input {
  width: 100% !important;
  min-height: 40px;
  padding: 0 12px 0 36px !important;
  border: 1px solid var(--admin-line) !important;
  border-radius: 7px !important;
  color: var(--admin-ink) !important;
  background: var(--admin-surface-soft) !important;
  box-shadow: none !important;
  font-size: 13px;
}

.admin-header-action {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 1px solid transparent;
  border-radius: 7px !important;
  color: var(--admin-muted) !important;
  background: transparent;
  box-shadow: none !important;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.admin-header-action:hover {
  border-color: var(--admin-line);
  color: var(--admin-ink) !important;
  background: var(--admin-surface-soft) !important;
}

.admin-header-action .material-symbols-outlined,
.admin-mobile-menu .material-symbols-outlined {
  font-size: 21px;
}

.admin-sidebar-backdrop {
  display: none;
}

/* Main workspace */
.market-admin .admin-main {
  min-width: 0;
  padding: 28px max(30px, var(--admin-safe-right)) max(28px, var(--admin-safe-bottom)) 30px !important;
  overflow-y: auto;
  background: var(--admin-bg) !important;
  overscroll-behavior: contain;
}

.market-admin .admin-main > .tab-panel {
  width: min(1500px, 100%);
  margin: 0 auto;
  animation: admin-panel-enter 160ms ease both;
}

@keyframes admin-panel-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.refreshing-panel {
  opacity: 0.55;
  pointer-events: none;
}

#refresh-btn.is-refreshing .material-symbols-outlined {
  animation: admin-spin 700ms linear infinite;
}

@keyframes admin-spin {
  to { transform: rotate(360deg); }
}

/* Dashboard */
.admin-stat-grid {
  display: grid !important;
  grid-template-columns: minmax(230px, 1.22fr) repeat(3, minmax(0, 1fr)) !important;
  gap: 0 !important;
  margin: 0 0 20px !important;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

.admin-metric {
  position: relative;
  min-width: 0;
  min-height: 148px;
  padding: 23px 24px 21px;
  border-left: 1px solid var(--admin-line);
  background: var(--admin-surface);
}

.admin-metric:first-child {
  border-left: 0;
  color: #ffffff;
  background: #1d1d1f;
}

.admin-metric:first-child .admin-metric-head p,
.admin-metric:first-child .admin-metric-sub {
  color: rgba(255, 255, 255, 0.62);
}

.admin-metric:first-child h2 {
  color: #ffffff;
}

.admin-metric:first-child .admin-metric-icon {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

html.dark .admin-metric:first-child {
  color: #1d1d1f;
  background: #f5f5f7;
}

html.dark .admin-metric:first-child .admin-metric-head p,
html.dark .admin-metric:first-child .admin-metric-sub {
  color: rgba(29, 29, 31, 0.62);
}

html.dark .admin-metric:first-child h2 {
  color: #1d1d1f;
}

html.dark .admin-metric:first-child .admin-metric-icon {
  color: #1d1d1f;
  background: rgba(29, 29, 31, 0.09);
}

.admin-metric--primary { --metric-color: var(--admin-primary); }
.admin-metric--tertiary { --metric-color: var(--admin-success); }
.admin-metric--secondary { --metric-color: var(--admin-teal); }
.admin-metric--error { --metric-color: var(--admin-danger); }

.admin-metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-metric-head p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.admin-metric-icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--metric-color, var(--admin-primary));
  background: color-mix(in srgb, var(--metric-color, var(--admin-primary)) 10%, transparent);
  font-size: 18px;
}

.admin-metric h2 {
  margin: 14px 0 0;
  overflow: hidden;
  color: var(--admin-ink);
  font-size: 32px;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.admin-metric-sub {
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-dashboard-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.72fr) !important;
  align-items: start;
  gap: 20px !important;
}

.market-admin .admin-activity-panel,
.market-admin .admin-quick-actions {
  padding: 24px !important;
  border: 1px solid var(--admin-line) !important;
  border-radius: var(--admin-radius) !important;
  background: var(--admin-surface) !important;
  box-shadow: none !important;
}

.admin-activity-panel h3,
.admin-quick-actions h3 {
  margin: 0 0 15px !important;
  color: var(--admin-ink);
  font-size: 18px !important;
  font-weight: 650 !important;
  letter-spacing: 0;
}

#recent-activity {
  display: grid;
  gap: 0 !important;
}

.admin-activity-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 10px 0;
  border-top: 1px solid var(--admin-line);
}

.admin-activity-item:first-child {
  border-top: 0;
}

.admin-activity-marker {
  position: relative;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
}

.admin-activity-marker::before {
  position: absolute;
  top: 20px;
  bottom: -44px;
  left: 10px;
  width: 1px;
  background: var(--admin-line);
  content: "";
}

.admin-activity-item:last-child .admin-activity-marker::before {
  display: none;
}

.admin-activity-marker i {
  position: relative;
  z-index: 1;
  width: 8px;
  height: 8px;
  border: 2px solid var(--admin-surface);
  border-radius: 50%;
  background: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-soft);
}

.admin-activity-copy {
  min-width: 0;
}

.admin-activity-copy p,
.admin-activity-copy small {
  display: block;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-activity-copy p {
  color: var(--admin-ink);
  font-size: 13px;
  font-weight: 550;
}

.admin-activity-copy small {
  margin-top: 4px;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-activity-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
}

.admin-activity-status--success {
  color: var(--admin-success);
  background: var(--admin-success-soft);
}

.admin-activity-status--danger {
  color: var(--admin-danger);
  background: var(--admin-danger-soft);
}

.admin-command-list {
  display: grid;
}

.admin-command-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 8px 0;
  border: 0;
  border-top: 1px solid var(--admin-line);
  border-radius: 0 !important;
  color: var(--admin-ink);
  background: transparent;
  box-shadow: none !important;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-command-row:first-child {
  border-top: 0;
}

.admin-command-row:hover {
  color: var(--admin-primary);
}

.admin-command-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--admin-primary);
  background: var(--admin-primary-soft);
  font-size: 19px;
}

.admin-command-row > .material-symbols-outlined:last-child {
  color: var(--admin-soft);
  font-size: 18px;
}

/* Data workspaces */
body.market-admin .admin-workspace {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* New API-style channel management */
.admin-channels-workspace {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.newapi-channel-toolbar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.newapi-channel-actions,
.newapi-channel-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.newapi-channel-actions {
  min-height: 38px;
}

.newapi-channel-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(170px, 0.8fr) 132px 132px auto auto;
  min-width: 0;
}

.newapi-btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 13px;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  color: var(--admin-ink);
  background: var(--admin-surface);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.newapi-btn:hover {
  border-color: var(--admin-line-strong);
  background: var(--admin-surface-soft);
}

.newapi-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.newapi-btn .material-symbols-outlined {
  font-size: 17px;
}

.newapi-btn-primary,
.newapi-btn-query {
  border-color: var(--admin-primary);
  color: #fff;
  background: var(--admin-primary);
}

.newapi-btn-primary:hover,
.newapi-btn-query:hover {
  border-color: var(--admin-primary-hover);
  color: #fff;
  background: var(--admin-primary-hover);
}

.newapi-btn-quiet {
  border-color: transparent;
  color: var(--admin-muted);
  background: transparent;
}

.newapi-input {
  position: relative;
  display: block;
  min-width: 0;
}

.newapi-input > .material-symbols-outlined {
  position: absolute;
  top: 50%;
  left: 11px;
  z-index: 1;
  color: var(--admin-muted);
  font-size: 17px;
  pointer-events: none;
  transform: translateY(-50%);
}

.newapi-input input,
.newapi-channel-filters select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--admin-line) !important;
  border-radius: 6px !important;
  color: var(--admin-ink);
  background: var(--admin-surface) !important;
  font-size: 12px;
  box-shadow: none !important;
}

.newapi-input input {
  padding: 0 10px 0 34px !important;
}

.newapi-channel-filters select {
  padding: 0 30px 0 10px !important;
}

.newapi-input input::placeholder {
  color: var(--admin-soft);
}

.channel-summary {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--admin-muted);
  font-size: 12px;
}

.channel-summary strong {
  color: var(--admin-ink);
  font-weight: 700;
}

.channel-filter-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--admin-primary);
}

.channel-filter-count .material-symbols-outlined {
  font-size: 15px;
}

.channel-secondary-btn {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  color: var(--admin-ink);
  background: var(--admin-surface);
  font-size: 12px;
  font-weight: 600;
}

.channel-secondary-btn:hover {
  background: var(--admin-surface-soft);
}

#channels-table-container {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

.channel-table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.channel-table {
  width: 100%;
  min-width: 1110px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.channel-table th {
  height: 42px;
  padding: 0 9px;
  border-bottom: 1px solid var(--admin-line);
  color: var(--admin-muted);
  background: var(--admin-surface-soft);
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.channel-table td {
  height: 58px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--admin-line);
  color: var(--admin-ink);
  vertical-align: middle;
}

.channel-table [data-column="type"] { width: 86px; }
.channel-table [data-column="id"] { width: 48px; }
.channel-table [data-column="name"] { width: 168px; }
.channel-table [data-column="status"] { width: 82px; }
.channel-table [data-column="groups"] { width: 116px; }
.channel-table [data-column="priority"],
.channel-table [data-column="weight"] { width: 72px; }
.channel-table [data-column="models"] { width: 184px; }
.channel-table [data-column="balance"] { width: 76px; }
.channel-table [data-column="response"] { width: 80px; }
.channel-table [data-column="actions"] { width: 136px; }

.channel-table th[data-column="actions"],
.channel-table td[data-column="actions"] {
  position: sticky;
  right: 0;
  z-index: 2;
  box-shadow: -8px 0 12px -12px rgba(24, 33, 43, 0.45);
}

.channel-table th[data-column="actions"] {
  z-index: 3;
  background: var(--admin-surface-soft);
  text-align: right;
}

.channel-table td[data-column="actions"] {
  background: var(--admin-surface);
}

.channel-table tr:hover td[data-column="actions"] {
  background: color-mix(in srgb, var(--admin-primary) 3%, var(--admin-surface));
}

.channel-table tbody tr:last-child td { border-bottom: 0; }
.channel-table tbody tr:hover { background: color-mix(in srgb, var(--admin-primary) 3%, var(--admin-surface)); }
.channel-id { color: var(--admin-muted) !important; font-variant-numeric: tabular-nums; }

.channel-type-badge,
.channel-tags span,
.channel-models span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  color: var(--admin-ink);
  background: var(--admin-surface-soft);
  font-size: 11px;
  white-space: nowrap;
}

.channel-type-badge {
  color: var(--admin-primary);
  border-color: color-mix(in srgb, var(--admin-primary) 25%, var(--admin-line));
  background: var(--admin-primary-soft);
  font-weight: 650;
}

.channel-name-cell { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.channel-name-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-name-cell small { overflow: hidden; color: var(--admin-muted); text-overflow: ellipsis; white-space: nowrap; }
.channel-tags, .channel-models { display: flex; min-width: 0; align-items: center; gap: 4px; overflow: hidden; }
.channel-tags > span, .channel-models > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.channel-tags small,
.channel-models small { color: var(--admin-muted); white-space: nowrap; }

.channel-status {
  min-height: 26px;
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.channel-status--enabled { color: var(--admin-success); background: var(--admin-success-soft); }
.channel-status--disabled { color: var(--admin-danger); background: var(--admin-danger-soft); }
.channel-status--warning { color: var(--admin-warning); background: var(--admin-warning-soft); }

.channel-number-input {
  width: 54px !important;
  min-height: 32px;
  padding: 3px 6px !important;
  border: 1px solid var(--admin-line) !important;
  border-radius: 5px !important;
  background: var(--admin-surface) !important;
  font-variant-numeric: tabular-nums;
}

.channel-balance,
.channel-latency { color: var(--admin-success); font-variant-numeric: tabular-nums; white-space: nowrap; }
.channel-latency.is-empty { color: var(--admin-muted); }
.channel-actions { display: grid; grid-template-columns: repeat(4, 28px); align-items: center; justify-content: end; gap: 2px; }
.channel-actions button { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border: 0; border-radius: 5px; color: var(--admin-muted); background: transparent; cursor: pointer; }
.channel-actions button:hover { color: var(--admin-primary); background: var(--admin-primary-soft); }
.channel-actions button.is-danger:hover { color: var(--admin-danger); background: var(--admin-danger-soft); }
.channel-actions .material-symbols-outlined { font-size: 17px; }

.channel-empty,
.channel-loading { display: flex; min-height: 260px; align-items: center; justify-content: center; flex-direction: column; color: var(--admin-muted); text-align: center; }
.channel-empty > .material-symbols-outlined { margin-bottom: 10px; font-size: 36px; }
.channel-empty strong { color: var(--admin-ink); }
.channel-empty p { margin: 5px 0 0; font-size: 13px; }
.channel-empty .newapi-btn { margin-top: 18px; }
.channel-empty--error > .material-symbols-outlined { color: var(--admin-danger); }
.channel-loading { min-height: 220px; gap: 10px; font-size: 12px; }
.channel-loading .material-symbols-outlined { color: var(--admin-primary); font-size: 24px; }

.channel-columns-panel > p {
  margin: 0 0 16px;
  color: var(--admin-muted);
  font-size: 13px;
}

.channel-columns-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.channel-columns-grid label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  color: var(--admin-ink);
  font-size: 12px;
}

.channel-columns-grid label:has(input:checked) {
  border-color: color-mix(in srgb, var(--admin-primary) 35%, var(--admin-line));
  background: var(--admin-primary-soft);
}

.channel-columns-grid input {
  width: 16px;
  height: 16px;
  appearance: auto !important;
  accent-color: var(--admin-primary);
}
.channel-columns-grid small { margin-left: auto; color: var(--admin-muted); font-size: 10px; }

.channel-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.channel-form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.channel-form label:not(.channel-switch-card) { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.channel-form label > span { color: var(--admin-ink); font-size: 11px; font-weight: 650; }
.channel-form label > span em { color: var(--admin-danger); font-style: normal; }
.channel-form label > small { color: var(--admin-muted); font-size: 10px; line-height: 1.45; }
.channel-form input:not([type="checkbox"]), .channel-form select { min-height: 38px; padding: 7px 10px; }
.channel-form textarea { padding: 9px 10px; line-height: 1.55; resize: vertical; }
.channel-field-wide { grid-column: 1 / -1; }

.channel-provider-select,
.channel-secret-field { position: relative; min-width: 0; }
.channel-provider-select > span {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 50%;
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  color: var(--admin-primary);
  font-size: 10px;
  font-weight: 750;
}
.channel-provider-select select { width: 100%; padding-left: 36px !important; }
.channel-secret-field textarea { width: 100%; padding-right: 42px; }
.channel-secret-field textarea.is-masked { -webkit-text-security: disc; }
.channel-secret-field button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  width: auto;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  color: var(--admin-muted);
  background: var(--admin-surface-soft);
  font-size: 10px;
  font-weight: 650;
}
.channel-secret-field button:hover { color: var(--admin-ink); }
.channel-code-field { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px !important; }

.channel-switch-card {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface-soft);
}
.channel-switch-card > span { display: flex; flex-direction: column; gap: 2px; }
.channel-switch-card strong { color: var(--admin-ink); font-size: 11px; font-weight: 650; }
.channel-switch-card small { color: var(--admin-muted); font-size: 10px; font-weight: 400; line-height: 1.4; }
.channel-switch-card input {
  position: relative;
  width: 36px !important;
  height: 20px !important;
  flex: 0 0 auto;
  appearance: none !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: var(--admin-surface-strong) !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background .18s ease;
}
.channel-switch-card input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: transform .18s ease; }
.channel-switch-card input:checked { background: var(--admin-primary) !important; }
.channel-switch-card input:checked::after { transform: translateX(16px); }

.channel-primary-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 17px; border: 1px solid var(--admin-primary); color: #fff; background: var(--admin-primary); }
.channel-primary-btn:hover { filter: brightness(.96); }
.channel-primary-btn .material-symbols-outlined { font-size: 17px; }
.channel-primary-btn:disabled { opacity: .55; cursor: wait; }
.channel-mobile-card > p { overflow: hidden; margin: 8px 0; color: var(--admin-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.channel-mobile-card .admin-mobile-item-head > div { display: flex; min-width: 0; align-items: center; gap: 8px; }
.channel-mobile-card .channel-actions { margin-top: 12px; justify-content: flex-start; }

@keyframes channel-spin { to { transform: rotate(360deg); } }
.channel-spin { animation: channel-spin 0.8s linear infinite; }

@media (max-width: 1100px) {
  .newapi-channel-filters { grid-template-columns: repeat(2, minmax(0, 1fr)) 132px 132px; }
  .newapi-btn-query,
  .newapi-btn-quiet { grid-column: span 2; }
}

@media (max-width: 767px) {
  .newapi-channel-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
  .newapi-channel-actions .newapi-btn:not(.newapi-btn-primary) { width: 40px; padding: 0; font-size: 0; }
  .newapi-channel-actions .newapi-btn:not(.newapi-btn-primary) .material-symbols-outlined { font-size: 18px; }
  .newapi-channel-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .newapi-channel-filters .newapi-input { grid-column: 1 / -1; }
  .newapi-btn-query,
  .newapi-btn-quiet { grid-column: auto; }
  .channel-summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  #channels-table-container { overflow: visible; border: 0; background: transparent; }
  .channel-columns-grid { grid-template-columns: minmax(0, 1fr); }
  .channel-form-grid,
  .channel-form-grid--three { grid-template-columns: minmax(0, 1fr); }
  .channel-field-wide { grid-column: auto; }
}

/* Channel management information architecture */
.admin-channels-workspace {
  gap: 18px;
}

.newapi-channel-toolbar {
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--admin-line);
}

.channel-toolbar-main {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.channel-summary {
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
}

.channel-summary-item {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  padding: 0 18px;
  border-left: 1px solid var(--admin-line);
}

.channel-summary-item:first-child {
  padding-left: 0;
  border-left: 0;
}

.channel-summary-item strong {
  color: var(--admin-ink);
  font-size: 20px;
  font-weight: 720;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.channel-summary-item span {
  color: var(--admin-muted);
  font-size: 11px;
  white-space: nowrap;
}

.channel-summary-item--good strong { color: var(--admin-success); }
.channel-summary-item--warn strong { color: var(--admin-warning); }

.channel-filter-count {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin-left: 14px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--admin-primary);
  background: var(--admin-primary-soft);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.newapi-channel-actions {
  flex: 0 0 auto;
}

.newapi-icon-btn {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  color: var(--admin-muted);
  background: var(--admin-surface);
  cursor: pointer;
}

.newapi-icon-btn:hover {
  color: var(--admin-primary);
  border-color: color-mix(in srgb, var(--admin-primary) 30%, var(--admin-line));
  background: var(--admin-primary-soft);
}

.newapi-icon-btn:disabled {
  cursor: wait;
  opacity: 0.5;
}

.newapi-icon-btn .material-symbols-outlined { font-size: 18px; }

.newapi-channel-filters {
  grid-template-columns: minmax(260px, 1.5fr) minmax(150px, 0.7fr) 132px 132px auto auto;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface-soft);
}

.newapi-input input,
.newapi-channel-filters select {
  min-height: 36px;
  border-color: transparent !important;
  background: var(--admin-surface) !important;
}

.newapi-input input:hover,
.newapi-channel-filters select:hover {
  border-color: var(--admin-line) !important;
}

.newapi-channel-filters .newapi-btn {
  min-height: 36px;
}

#channels-table-container {
  overflow: hidden;
  border-color: var(--admin-line);
  border-radius: 8px;
}

.channel-table {
  min-width: 1010px;
  table-layout: fixed;
  font-size: 12px;
}

.channel-table th {
  height: 43px;
  padding: 0 13px;
  color: var(--admin-muted);
  background: var(--admin-surface-soft);
  font-size: 10px;
  font-weight: 700;
}

.channel-table td {
  height: 78px;
  padding: 11px 13px;
}

.channel-table [data-column="channel"] { width: 250px; }
.channel-table [data-column="status"] { width: 104px; }
.channel-table [data-column="scope"] { width: 230px; }
.channel-table [data-column="routing"] { width: 170px; }
.channel-table [data-column="health"] { width: 142px; }
.channel-table [data-column="actions"] { width: 136px; }

.channel-table tbody tr {
  background: var(--admin-surface);
}

.channel-table tbody tr:hover {
  background: color-mix(in srgb, var(--admin-primary) 2.5%, var(--admin-surface));
}

.channel-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.channel-identity > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.channel-identity strong,
.channel-identity span,
.channel-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-identity strong {
  color: var(--admin-ink);
  font-size: 13px;
  font-weight: 700;
}

.channel-identity > div > span {
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 10px;
}

.channel-identity small {
  margin-top: 3px;
  color: var(--admin-soft);
  font-size: 10px;
}

.channel-provider-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  color: var(--admin-ink);
  background: var(--admin-surface-soft);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0;
}

.channel-provider-mark--openai { color: #f8fafc; border-color: #20242a; background: #20242a; }
.channel-provider-mark--anthropic { color: #8b451f; border-color: #f0c8aa; background: #fff0e5; }
.channel-provider-mark--newapi { color: #1f5ad5; border-color: #b9ccfa; background: #eaf0ff; }
.channel-provider-mark--azure { color: #087f8c; border-color: #b6e1e5; background: #e7f7f8; }
.channel-provider-mark--gemini { color: #167447; border-color: #b8dfc9; background: #e8f6ee; }
.channel-provider-mark--openrouter { color: #7052b8; border-color: #d5c8ef; background: #f2edfc; }

html.dark .channel-provider-mark--anthropic { color: #ffc49a; border-color: #66402c; background: #38251c; }
html.dark .channel-provider-mark--newapi { color: #9db7ff; border-color: #34466f; background: #202d4c; }
html.dark .channel-provider-mark--azure { color: #77d5df; border-color: #31565d; background: #1b3439; }
html.dark .channel-provider-mark--gemini { color: #7ed1a2; border-color: #315b43; background: #1b3527; }
html.dark .channel-provider-mark--openrouter { color: #c5b0ff; border-color: #4d416b; background: #302747; }

.channel-state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  color: var(--admin-muted);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.channel-state i {
  display: block;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent);
}

.channel-state--enabled { color: var(--admin-success); }
.channel-state--disabled { color: var(--admin-danger); }
.channel-state--warning { color: var(--admin-warning); }

.channel-scope {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.channel-scope p,
.channel-scope > small {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-scope p {
  color: var(--admin-ink);
  font-size: 11px;
}

.channel-scope > small {
  color: var(--admin-soft);
  font-size: 10px;
}

.channel-tags span {
  min-height: 20px;
  padding: 1px 7px;
  border: 0;
  color: var(--admin-muted);
  background: var(--admin-surface-soft);
  font-size: 10px;
}

.channel-routing {
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-routing label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-routing label > span {
  color: var(--admin-soft);
  font-size: 9px;
}

.channel-routing .channel-number-input {
  width: 60px !important;
  min-height: 30px;
  padding: 2px 7px !important;
  border-color: transparent !important;
  background: var(--admin-surface-soft) !important;
  font-size: 11px;
}

.channel-routing .channel-number-input:hover,
.channel-routing .channel-number-input:focus {
  border-color: var(--admin-line-strong) !important;
  background: var(--admin-surface) !important;
}

.channel-health {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.channel-health strong {
  color: var(--admin-success);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.channel-health strong.is-empty { color: var(--admin-muted); }
.channel-health span,
.channel-health small { overflow: hidden; color: var(--admin-soft); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.channel-health small { color: var(--admin-muted); }

.channel-actions {
  grid-template-columns: repeat(4, 29px);
  gap: 2px;
  opacity: 0.72;
  transition: opacity 120ms ease;
}

.channel-table tr:hover .channel-actions,
.channel-actions:focus-within { opacity: 1; }

.channel-actions button {
  width: 29px;
  height: 29px;
}

.channel-actions-cell {
  padding-right: 10px !important;
}

.channel-mobile-head,
.channel-mobile-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.channel-mobile-endpoint {
  overflow: hidden;
  margin: 13px 0 0 !important;
  color: var(--admin-muted) !important;
  font-size: 11px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-mobile-scope {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.channel-mobile-scope > span {
  overflow: hidden;
  color: var(--admin-ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-mobile-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-line);
}

.channel-mobile-footer > span {
  color: var(--admin-soft);
  font-size: 9px;
}

@media (max-width: 1100px) {
  .newapi-channel-filters {
    grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.8fr) 132px 132px;
  }

  .newapi-btn-query,
  .newapi-btn-quiet {
    grid-column: auto;
  }
}

@media (max-width: 767px) {
  .admin-channels-workspace { gap: 14px; }
  .newapi-channel-toolbar { gap: 13px; padding-bottom: 14px; }
  .channel-toolbar-main { align-items: flex-start; flex-direction: column-reverse; gap: 14px; }
  .newapi-channel-actions { display: flex; width: 100%; }
  .newapi-channel-actions .newapi-btn-primary { flex: 1; }
  .newapi-icon-btn { flex: 0 0 40px; width: 40px; height: 40px; }
  .channel-summary { width: 100%; overflow-x: auto; }
  .channel-summary-item { padding: 0 14px; }
  .channel-summary-item strong { font-size: 18px; }
  .channel-filter-count { margin-left: 10px; }
  .newapi-channel-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px; }
  .newapi-channel-filters .newapi-input { grid-column: 1 / -1; }
  .newapi-channel-filters .newapi-btn { grid-column: auto; }
  #channels-table-container { overflow: visible; }
  .channel-mobile-list { display: grid; gap: 10px; }
  .channel-mobile-card {
    padding: 16px !important;
    border: 1px solid var(--admin-line) !important;
    border-radius: 8px !important;
    background: var(--admin-surface) !important;
  }
  .channel-mobile-card dl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-top: 14px;
    padding: 11px 0;
    border-top: 1px solid var(--admin-line);
    border-bottom: 1px solid var(--admin-line);
  }
  .channel-mobile-card dl > div {
    padding: 0 8px;
    border-left: 1px solid var(--admin-line);
  }
  .channel-mobile-card dl > div:first-child { padding-left: 0; border-left: 0; }
  .channel-mobile-card dl > div:last-child { padding-right: 0; }
  .channel-mobile-card dt { font-size: 9px; }
  .channel-mobile-card dd { margin-top: 4px; font-size: 11px; }
  .channel-mobile-card .channel-actions { margin-top: 0; }
}

.admin-workspace-head {
  min-height: 0;
  margin: 0 0 18px !important;
}

.admin-workspace-head h3,
.admin-settings-workspace > h3 {
  display: none;
}

.admin-workspace-head p {
  margin: 0 !important;
  color: var(--admin-muted) !important;
  font-size: 13px !important;
}

.admin-filter-bar {
  align-items: center;
  gap: 8px !important;
  margin: 0 0 14px !important;
  padding: 6px;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface-soft);
}

.market-admin input:not([type="checkbox"]):not([type="radio"]),
.market-admin select,
.market-admin textarea {
  border: 1px solid var(--admin-line) !important;
  border-radius: 7px !important;
  color: var(--admin-ink) !important;
  background: var(--admin-surface) !important;
  box-shadow: none !important;
}

.market-admin input:not([type="checkbox"]):not([type="radio"]):focus,
.market-admin select:focus,
.market-admin textarea:focus {
  border-color: var(--admin-primary) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--admin-primary) 12%, transparent) !important;
}

.admin-filter-bar input,
.admin-filter-bar select {
  min-height: 40px;
}

.market-admin button.bg-primary,
.market-admin .bg-primary.text-on-primary,
#add-user-btn,
#add-code-btn {
  min-height: 42px;
  border: 0 !important;
  border-radius: 7px !important;
  color: #ffffff !important;
  background: var(--admin-primary) !important;
  box-shadow: none !important;
  font-weight: 650 !important;
}

.market-admin button.bg-primary:hover,
.market-admin .bg-primary.text-on-primary:hover,
#add-user-btn:hover,
#add-code-btn:hover {
  background: var(--admin-primary-hover) !important;
}

#export-codes-btn {
  min-height: 42px;
  border: 1px solid var(--admin-line) !important;
  border-radius: 7px !important;
  color: var(--admin-ink) !important;
  background: var(--admin-surface) !important;
  box-shadow: none !important;
  font-weight: 600 !important;
}

#users-table-container,
#codes-table-container,
#logs-container .admin-desktop-table > .overflow-x-auto {
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

.admin-desktop-table {
  width: 100%;
  overflow-x: auto;
}

.market-admin table {
  width: 100%;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  color: var(--admin-ink);
  background: var(--admin-surface);
  font-size: 13px;
}

.market-admin thead tr,
.market-admin thead tr.bg-surface-container-high {
  background: var(--admin-surface) !important;
}

.market-admin th {
  height: 44px;
  padding: 0 12px !important;
  border-bottom: 1px solid var(--admin-line);
  color: var(--admin-muted) !important;
  background: var(--admin-surface) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: nowrap;
}

.market-admin td {
  height: 52px;
  padding: 8px 12px !important;
  border-bottom: 1px solid var(--admin-line);
  color: var(--admin-ink);
  background: transparent !important;
}

.market-admin tbody tr,
.market-admin tbody tr.bg-surface-container-lowest,
.market-admin tbody tr.bg-surface-container-low {
  background: var(--admin-surface) !important;
  box-shadow: none !important;
}

.market-admin tbody tr:hover {
  background: color-mix(in srgb, var(--admin-primary) 3.5%, var(--admin-surface)) !important;
}

.market-admin tbody tr:last-child td {
  border-bottom: 0;
}

.market-admin tbody button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 0;
  border-radius: 6px !important;
  background: transparent !important;
  box-shadow: none !important;
}

.market-admin tbody button:hover {
  background: var(--admin-surface-soft) !important;
}

.market-admin input[type="checkbox"],
.market-admin input[type="radio"] {
  width: 17px;
  height: 17px;
  border-color: var(--admin-line-strong) !important;
  color: var(--admin-primary) !important;
  background-color: var(--admin-surface) !important;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 15px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-pagination-actions,
.admin-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-pagination button,
.admin-bulk-bar button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  color: var(--admin-ink);
  background: var(--admin-surface);
  box-shadow: none !important;
  font-size: 12px;
  font-weight: 600;
}

.admin-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.admin-bulk-bar {
  min-height: 48px;
  margin-bottom: 14px;
  padding: 6px 8px 6px 14px;
  border: 1px solid color-mix(in srgb, var(--admin-primary) 22%, var(--admin-line));
  border-radius: var(--admin-radius);
  color: var(--admin-primary);
  background: var(--admin-primary-soft);
  font-size: 12px;
  font-weight: 600;
}

.admin-bulk-bar[hidden] {
  display: none;
}

/* Log metrics */
.admin-log-summary {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0 !important;
  margin: 0 0 14px !important;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

body.market-admin .admin-log-metric {
  min-width: 0;
  padding: 16px !important;
  border-left: 1px solid var(--admin-line);
  border-radius: 0 !important;
  background: var(--admin-surface) !important;
}

body.market-admin .admin-log-metric:first-child {
  border-left: 0;
  color: #ffffff;
  background: #1d1d1f !important;
}

body.market-admin .admin-log-metric:first-child span,
body.market-admin .admin-settings-metric:first-child span,
body.market-admin .admin-settings-metric:first-child small {
  color: rgba(255, 255, 255, 0.62);
}

body.market-admin .admin-log-metric:first-child strong,
body.market-admin .admin-settings-metric:first-child strong {
  color: #ffffff;
}

html.dark body.market-admin .admin-log-metric:first-child {
  color: #1d1d1f;
  background: #f5f5f7 !important;
}

html.dark body.market-admin .admin-log-metric:first-child span,
html.dark body.market-admin .admin-settings-metric:first-child span,
html.dark body.market-admin .admin-settings-metric:first-child small {
  color: rgba(29, 29, 31, 0.62);
}

html.dark body.market-admin .admin-log-metric:first-child strong,
html.dark body.market-admin .admin-settings-metric:first-child strong {
  color: #1d1d1f;
}

.admin-log-metric span,
.admin-log-metric strong {
  display: block;
}

.admin-log-metric span {
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-log-metric strong {
  margin-top: 5px;
  overflow: hidden;
  color: var(--admin-ink);
  font-size: 19px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Settings */
.admin-settings-workspace > h3 {
  margin-bottom: 20px;
}

.admin-settings-summary {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0 !important;
  overflow: hidden;
  border: 1px solid var(--admin-line);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

body.market-admin .admin-settings-metric {
  min-width: 0;
  min-height: 126px;
  padding: 20px !important;
  border: 0 !important;
  border-left: 1px solid var(--admin-line) !important;
  border-radius: 0 !important;
  background: var(--admin-surface) !important;
}

body.market-admin .admin-settings-metric:first-child {
  border-left: 0 !important;
  color: #ffffff;
  background: #1d1d1f !important;
}

html.dark body.market-admin .admin-settings-metric:first-child {
  color: #1d1d1f;
  background: #f5f5f7 !important;
}

.admin-settings-metric span,
.admin-settings-metric strong,
.admin-settings-metric small {
  display: block;
  min-width: 0;
}

.admin-settings-metric span {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
}

.admin-settings-metric strong {
  margin-top: 9px;
  overflow: hidden;
  color: var(--admin-ink);
  font-size: 22px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-settings-metric small {
  margin-top: 7px;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-settings-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr) !important;
  gap: 18px !important;
}

body.market-admin .admin-settings-card,
body.market-admin .admin-system-status {
  min-width: 0;
  min-height: 236px;
  padding: 24px !important;
  border: 1px solid var(--admin-line) !important;
  border-radius: var(--admin-radius) !important;
  background: var(--admin-surface) !important;
  box-shadow: none !important;
}

body.market-admin .admin-settings-card {
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

body.market-admin .admin-settings-card:hover {
  border-color: var(--admin-line-strong) !important;
  background: color-mix(in srgb, var(--admin-primary) 2.5%, var(--admin-surface)) !important;
}

.admin-settings-card > .flex,
.admin-settings-card > .flex > .flex:first-child,
.admin-settings-card > .flex > .flex:first-child > div:last-child {
  min-width: 0;
}

.admin-settings-card > .flex > .flex:first-child {
  flex: 1 1 auto;
}

.admin-settings-card > .flex > .flex:last-child {
  flex: 0 0 auto;
}

.admin-settings-card .text-sm {
  overflow-wrap: anywhere;
}

.admin-settings-card .w-12.h-12 {
  width: 40px !important;
  height: 40px !important;
  flex: 0 0 40px;
  border-radius: 50% !important;
  color: var(--admin-primary) !important;
  background: var(--admin-primary-soft) !important;
}

.admin-system-status > .grid {
  gap: 0 !important;
  border-top: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
}

.admin-system-status > .grid > div {
  padding: 12px 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.admin-system-status > .grid > div + div {
  padding-left: 16px !important;
  border-left: 1px solid var(--admin-line) !important;
}

.admin-system-status > .rounded-xl {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

/* Mobile record list */
.admin-mobile-list {
  display: none;
}

.admin-mobile-item {
  min-width: 0;
  padding: 16px;
  border-bottom: 1px solid var(--admin-line);
  background: var(--admin-surface);
}

.admin-mobile-item:last-child {
  border-bottom: 0;
}

.admin-mobile-item-head,
.admin-mobile-check,
.admin-mobile-item-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.admin-mobile-item-head {
  justify-content: space-between;
}

.admin-mobile-item-head > span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.admin-mobile-item-head > div,
.admin-mobile-check {
  min-width: 0;
}

.admin-mobile-check {
  flex: 1 1 auto;
}

.admin-mobile-item-head > div {
  display: grid;
  gap: 3px;
}

.admin-mobile-item-head strong,
.admin-mobile-check span {
  min-width: 0;
  overflow: hidden;
  color: var(--admin-ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-mobile-item-head > div > span {
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-mobile-item dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
  padding: 12px 0;
  border-top: 1px solid var(--admin-line);
  border-bottom: 1px solid var(--admin-line);
}

.admin-mobile-item dt {
  margin-bottom: 4px;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-mobile-item dd {
  margin: 0;
  overflow: hidden;
  color: var(--admin-ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-log-mobile-item dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-mobile-item-actions {
  justify-content: flex-end;
}

.admin-mobile-icon-action {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  color: var(--admin-muted);
  background: var(--admin-surface);
}

.admin-mobile-icon-action .material-symbols-outlined {
  font-size: 18px;
}

.admin-mobile-icon-action--danger {
  color: var(--admin-danger);
}

/* Modal and notices */
.market-admin .modal-backdrop {
  padding: max(18px, var(--admin-safe-top)) max(18px, var(--admin-safe-right)) max(18px, var(--admin-safe-bottom)) max(18px, var(--admin-safe-left)) !important;
  background: rgba(0, 0, 0, 0.38) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.market-admin .modal-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(680px, 100%);
  max-height: calc(100vh - var(--admin-safe-top) - var(--admin-safe-bottom) - 36px) !important;
  max-height: calc(100dvh - var(--admin-safe-top) - var(--admin-safe-bottom) - 36px) !important;
  overflow: hidden !important;
  border: 1px solid var(--admin-line) !important;
  border-radius: var(--admin-radius) !important;
  background: var(--admin-surface) !important;
  box-shadow: var(--admin-shadow-float) !important;
}

.admin-modal-header,
.admin-modal-footer {
  min-height: 70px;
  padding: 16px 20px !important;
  border-color: var(--admin-line) !important;
  background: var(--admin-surface);
}

.admin-modal-header h2 {
  font-size: 20px !important;
  font-weight: 650 !important;
  letter-spacing: 0;
}

.admin-modal-header [data-close-modal] {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 0;
  border-radius: 50% !important;
  background: var(--admin-surface-soft) !important;
}

.market-admin .admin-modal-body {
  min-height: 0;
  max-height: none !important;
  padding: 20px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.admin-modal-footer {
  flex-wrap: wrap;
  padding-bottom: max(16px, var(--admin-safe-bottom)) !important;
}

.admin-modal-footer button {
  min-height: 42px;
  border-radius: 7px !important;
  font-size: 13px;
  font-weight: 600;
}

.admin-notification {
  right: calc(18px + var(--admin-safe-right)) !important;
  top: calc(18px + var(--admin-safe-top)) !important;
  max-width: min(380px, calc(100vw - 36px - var(--admin-safe-left) - var(--admin-safe-right)));
  border-color: var(--admin-line) !important;
  border-radius: 8px !important;
  background: var(--admin-surface) !important;
  box-shadow: var(--admin-shadow-float) !important;
  font-size: 13px;
}

.admin-notification--success { color: var(--admin-success) !important; }
.admin-notification--error { color: var(--admin-danger) !important; }
.admin-notification--warning { color: var(--admin-warning) !important; }
.admin-notification--info { color: var(--admin-primary) !important; }

@media (max-width: 1180px) {
  .admin-search-wrap {
    display: none;
  }

  .admin-stat-grid,
  .admin-settings-summary,
  .admin-log-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-metric:nth-child(3),
  .admin-settings-metric:nth-child(3),
  .admin-log-metric:nth-child(3) {
    border-left: 0 !important;
  }

  .admin-metric:nth-child(n + 3),
  .admin-settings-metric:nth-child(n + 3),
  .admin-log-metric:nth-child(n + 3) {
    border-top: 1px solid var(--admin-line);
  }

  .admin-settings-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (min-width: 1181px) {
  .admin-filter-bar {
    justify-content: flex-end;
    padding: 0;
    border: 0;
    background: transparent;
  }

  #user-search,
  #code-search,
  #log-search {
    display: none;
  }
}

@media (max-width: 900px), (max-width: 1050px) and (max-height: 500px) and (pointer: coarse) {
  body.market-admin {
    overflow: auto;
  }

  body.market-admin.admin-nav-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  #app-container {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
  }

  #admin-sidebar {
    z-index: 70;
    display: flex !important;
    width: min(294px, calc(100vw - 42px - var(--admin-safe-right))) !important;
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  body.admin-nav-open #admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.admin-nav-open .admin-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .market-admin .admin-content {
    width: 100%;
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    margin-left: 0 !important;
    overflow: visible;
  }

  .admin-mobile-menu {
    display: inline-flex;
  }

  .market-admin .admin-header {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: calc(108px + var(--admin-safe-top)) !important;
    height: auto !important;
    padding: calc(7px + var(--admin-safe-top)) max(12px, var(--admin-safe-right)) 7px max(12px, var(--admin-safe-left)) !important;
  }

  .admin-header-row {
    display: grid !important;
    grid-template-areas:
      "menu title actions"
      "switch switch switch";
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px 8px;
  }

  .admin-header-left {
    display: contents;
  }

  .admin-mobile-menu {
    grid-area: menu;
    width: 44px;
    height: 44px;
  }

  .admin-page-heading {
    grid-area: title;
    min-width: 0;
  }

  #page-title {
    width: auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-header-right {
    grid-area: actions;
    gap: 3px;
  }

  .admin-header-action {
    width: 44px;
    height: 44px;
  }

  .admin-service-switch {
    grid-area: switch;
    width: 100%;
  }

  .admin-service-switch button {
    flex: 1;
    min-height: 42px;
  }

  .market-admin .admin-main {
    padding: 16px max(16px, var(--admin-safe-right)) max(16px, var(--admin-safe-bottom)) max(16px, var(--admin-safe-left)) !important;
    overflow: visible;
  }

  .admin-dashboard-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .admin-metric {
    min-height: 112px;
    padding: 17px 18px;
  }

  .admin-metric h2 {
    margin-top: 10px;
    font-size: 26px;
  }

  .admin-workspace-head {
    align-items: stretch !important;
    flex-direction: column;
    gap: 14px;
  }

  .admin-workspace-head > .flex {
    width: 100%;
  }

  .admin-workspace-head button {
    flex: 1;
    justify-content: center;
  }

  .admin-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-filter-bar input,
  .admin-filter-bar select {
    width: 100% !important;
  }

  .admin-desktop-table {
    display: none;
  }

  .admin-mobile-list {
    display: block;
    overflow: hidden;
    border: 1px solid var(--admin-line);
    border-radius: var(--admin-radius);
    background: var(--admin-surface);
  }

  #users-table-container,
  #codes-table-container {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #logs-container .admin-desktop-table > .overflow-x-auto {
    max-width: 100%;
    padding-bottom: 6px;
    overflow-x: auto;
    border-inline-end: 3px solid color-mix(in srgb, var(--admin-primary) 42%, var(--admin-line));
    scrollbar-color: var(--admin-primary) var(--admin-surface-strong);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .admin-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-bulk-bar {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

@media (min-width: 601px) and (max-width: 1050px) and (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .market-admin .admin-header {
    min-height: calc(64px + var(--admin-safe-top)) !important;
  }

  .admin-header-row {
    grid-template-areas: "menu title switch actions";
    grid-template-columns: auto minmax(72px, 1fr) minmax(210px, 260px) auto;
  }

  .admin-page-live {
    display: none;
  }

  .admin-service-switch {
    width: auto;
  }

  .market-admin .admin-main {
    padding-top: 12px !important;
  }

  .admin-metric {
    min-height: 102px;
    padding: 14px 16px;
  }

  .admin-metric h2 {
    font-size: 24px;
  }
}

@media (max-width: 620px) {
  .admin-login-overlay {
    padding: max(64px, var(--admin-safe-top)) max(16px, var(--admin-safe-right)) max(16px, var(--admin-safe-bottom)) max(16px, var(--admin-safe-left)) !important;
  }

  .admin-login-home {
    top: calc(10px + var(--admin-safe-top));
    left: calc(16px + var(--admin-safe-left));
  }

  .admin-login-shell {
    grid-template-columns: minmax(0, 1fr);
    width: min(420px, 100%);
    min-height: 0;
  }

  .admin-login-brand-panel {
    min-height: 132px;
    padding: 22px 24px;
  }

  .admin-login-brand-copy {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: auto 0 0;
  }

  .admin-login-brand-copy > span {
    display: none;
  }

  .admin-login-brand-copy h1 {
    margin: 0;
    font-size: 25px;
  }

  .admin-login-status {
    position: absolute;
    align-self: flex-end;
    margin-top: 4px;
  }

  .admin-login-form-panel {
    padding: 32px 24px 28px;
  }

  .admin-login-form-panel header {
    margin-bottom: 24px;
  }

  .admin-login-form-panel h2 {
    font-size: 23px;
  }

  .admin-page-live {
    display: none;
  }

  .admin-stat-grid {
    margin-bottom: 14px !important;
  }

  .admin-metric {
    min-height: 102px;
    padding: 14px;
  }

  .admin-metric-icon {
    width: 26px;
    height: 26px;
    font-size: 16px;
  }

  .admin-metric h2 {
    margin-top: 8px;
    font-size: 23px;
  }

  .admin-metric-sub {
    margin-top: 5px;
    font-size: 11px;
  }

  .admin-activity-copy p {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.4;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .admin-activity-copy small {
    line-height: 1.35;
    white-space: normal;
  }

  .market-admin .admin-activity-panel,
  .market-admin .admin-quick-actions {
    padding: 18px !important;
  }

  .admin-settings-summary,
  .admin-log-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-settings-metric,
  .admin-log-metric {
    min-height: auto !important;
    border-top: 0 !important;
    border-left: 1px solid var(--admin-line) !important;
  }

  .admin-settings-metric:nth-child(odd),
  .admin-log-metric:nth-child(odd) {
    border-left: 0 !important;
  }

  .admin-settings-metric:nth-child(n + 3),
  .admin-log-metric:nth-child(n + 3) {
    border-top: 1px solid var(--admin-line) !important;
  }

  .admin-settings-grid {
    gap: 14px !important;
  }

  .market-admin .admin-settings-card,
  .market-admin .admin-system-status {
    min-height: 0;
    padding: 18px !important;
  }

  .admin-mobile-item dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #codes-table-container .admin-mobile-item dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .market-admin .modal-backdrop {
    align-items: flex-end !important;
    padding: max(12px, var(--admin-safe-top)) 0 0 !important;
  }

  .market-admin .modal-content {
    width: 100%;
    max-height: calc(100dvh - var(--admin-safe-top) - 12px) !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    border-radius: 8px 8px 0 0 !important;
  }

  .admin-modal-header,
  .admin-modal-footer {
    padding-right: max(16px, var(--admin-safe-right)) !important;
    padding-left: max(16px, var(--admin-safe-left)) !important;
  }

  .market-admin .admin-modal-body {
    padding-right: max(16px, var(--admin-safe-right)) !important;
    padding-left: max(16px, var(--admin-safe-left)) !important;
  }
}

@media (min-width: 621px) and (max-height: 500px) {
  .market-admin .admin-login-overlay {
    padding: max(12px, var(--admin-safe-top)) max(18px, var(--admin-safe-right)) max(12px, var(--admin-safe-bottom)) max(18px, var(--admin-safe-left));
  }

  .admin-login-home {
    top: calc(4px + var(--admin-safe-top));
  }

  .admin-login-shell {
    width: min(760px, calc(100vw - 36px - var(--admin-safe-left) - var(--admin-safe-right)));
    min-height: 0;
    max-height: calc(100dvh - var(--admin-safe-top) - var(--admin-safe-bottom) - 24px);
  }

  .admin-login-brand-panel {
    padding: 24px 28px;
  }

  .admin-login-brand-copy h1 {
    font-size: 30px;
  }

  .admin-login-form-panel {
    padding: 28px 36px;
  }

  .admin-login-form-panel header {
    margin-bottom: 18px;
  }

  .admin-login-form-panel h2 {
    font-size: 22px;
  }

  .market-admin .admin-login-field input,
  .market-admin #login-submit {
    min-height: 44px;
  }
}

@media (max-width: 460px) {
  .market-admin .admin-header {
    min-height: calc(104px + var(--admin-safe-top)) !important;
  }

  .admin-header-row {
    gap: 4px 6px;
  }

  #page-title {
    max-width: 132px;
    font-size: 18px;
  }

  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-metric {
    min-height: 98px;
    padding: 13px 12px;
  }

  .admin-metric:nth-child(3) {
    border-left: 0;
  }

  .admin-metric:nth-child(n + 3) {
    border-top: 1px solid var(--admin-line);
  }

  .admin-metric-head p {
    font-size: 11px;
  }

  .admin-metric h2 {
    font-size: 22px;
  }

  .admin-workspace-head h3,
  .admin-settings-workspace > h3 {
    font-size: 21px !important;
  }

  .admin-pagination-actions {
    width: 100%;
    justify-content: space-between;
  }

  .admin-modal-footer {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-modal-footer button {
    width: 100%;
  }

  .admin-modal-footer button:last-child:nth-child(3) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 340px) {
  .admin-settings-card > .flex > .flex:last-child > span:first-child {
    display: none;
  }
}

@media (max-width: 900px) {
  body.admin-settings-view .admin-header {
    min-height: calc(64px + var(--admin-safe-top)) !important;
  }

  body.admin-settings-view .admin-header-row {
    grid-template-areas: "menu title actions";
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}

@media (pointer: coarse) {
  body.market-admin button,
  body.market-admin select,
  body.market-admin input:not([type="checkbox"]):not([type="radio"]),
  #admin-sidebar .nav-item,
  .admin-mobile-icon-action {
    min-height: 44px;
  }

  .admin-header-action,
  .admin-mobile-menu,
  .admin-mobile-icon-action {
    width: 44px;
    height: 44px;
  }

  body.market-admin input:not([type="checkbox"]):not([type="radio"]),
  body.market-admin select,
  body.market-admin textarea {
    font-size: 16px !important;
  }

  body.market-admin input[type="checkbox"],
  body.market-admin input[type="radio"] {
    width: 20px;
    height: 20px;
  }
}

@media (forced-colors: active) {
  #admin-sidebar,
  .market-admin .admin-header,
  .admin-stat-grid,
  .market-admin .admin-activity-panel,
  .market-admin .admin-quick-actions,
  #users-table-container,
  #codes-table-container,
  #logs-container > .overflow-x-auto,
  .admin-settings-summary,
  .market-admin .admin-settings-card,
  .market-admin .admin-system-status,
  .market-admin .modal-content,
  .admin-login-shell {
    border-color: CanvasText !important;
  }

  #admin-sidebar .nav-item.active,
  .admin-service-switch button[aria-pressed="true"] {
    border: 2px solid Highlight !important;
    color: HighlightText !important;
    background: Highlight !important;
  }

  .admin-sidebar-backdrop {
    background: CanvasText;
  }
}

@media (max-width: 767px) {
  .channel-toolbar-main .channel-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    align-items: stretch;
    flex-direction: row;
    gap: 0;
    overflow: visible;
  }

  .channel-toolbar-main .channel-summary-item {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 0 10px;
  }

  .channel-toolbar-main .channel-summary-item:first-child { padding-left: 0; }
  .channel-toolbar-main .channel-summary-item:last-of-type { padding-right: 0; }
  .channel-toolbar-main .channel-filter-count { grid-column: 1 / -1; width: max-content; margin: 9px 0 0; }

  .admin-mobile-list.channel-mobile-list {
    display: grid !important;
    gap: 10px;
  }

  .admin-mobile-list.channel-mobile-list .channel-mobile-card {
    padding: 16px !important;
    border: 1px solid var(--admin-line) !important;
    border-radius: 8px !important;
  }

  .admin-mobile-list.channel-mobile-list .channel-mobile-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 0;
  }

  .admin-mobile-list.channel-mobile-list .channel-mobile-footer {
    margin-top: 0;
    padding-top: 10px;
    border-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .market-admin .admin-main > .tab-panel,
  #admin-sidebar,
  .admin-sidebar-backdrop,
  #refresh-btn.is-refreshing .material-symbols-outlined {
    animation: none !important;
    transition-duration: 0.001ms !important;
  }
}

/* New API channel editor sheet */
.market-admin .modal-backdrop:has(.channel-modal-content) {
  align-items: stretch !important;
  justify-content: flex-end !important;
  padding: 0 !important;
  background: rgba(0, 0, 0, .1) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  backdrop-filter: blur(4px) !important;
}

.market-admin .modal-content.channel-modal-content {
  position: fixed !important;
  inset: 0 0 0 auto !important;
  width: min(1024px, 100vw) !important;
  max-width: 1024px !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  border: 0 !important;
  border-left: 1px solid var(--admin-line) !important;
  border-radius: 0 !important;
  background: var(--admin-surface) !important;
  box-shadow: none !important;
  animation: channel-sheet-in .2s ease-out;
}

@keyframes channel-sheet-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.channel-modal-content .admin-modal-header {
  min-height: 78px;
  align-items: flex-start !important;
  padding: 16px 24px !important;
  border-bottom: 1px solid var(--admin-line) !important;
  background: color-mix(in srgb, var(--admin-surface) 94%, transparent) !important;
}

.channel-modal-content .admin-modal-header h2 {
  min-width: 0;
  flex: 1 1 auto;
  font-size: inherit !important;
  font-weight: inherit !important;
}

.channel-modal-content .admin-modal-header [data-close-modal] {
  width: 32px;
  height: 32px;
  margin: -2px -8px 0 12px;
  border-radius: 6px !important;
  background: transparent !important;
}

.channel-sheet-title {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 12px;
}

.channel-sheet-title-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  color: var(--admin-primary);
  background: var(--admin-primary-soft);
  font-size: 11px;
  font-weight: 750;
}

.channel-sheet-title > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.channel-sheet-title strong { display: flex; min-width: 0; align-items: baseline; gap: 8px; color: var(--admin-ink); font-size: 16px; font-weight: 650; }
.channel-sheet-title strong small { color: var(--admin-muted); font-size: 12px; font-weight: 400; }
.channel-sheet-title > span:last-child > small { color: var(--admin-muted); font-size: 11px; font-weight: 400; }

.channel-modal-content .admin-modal-body {
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--admin-surface) !important;
}

.channel-modal-content .channel-form {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 20px;
  height: 100%;
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.channel-modal-content .channel-editor-nav {
  position: sticky;
  top: 0;
  display: block;
  align-self: start;
  max-height: calc(100dvh - 150px);
  padding: 0 4px 0 0;
  overflow-y: auto;
}

.channel-editor-provider-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--admin-surface-soft) 45%, transparent);
}

.channel-editor-provider-summary .channel-editor-provider-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  box-shadow: none;
}

.channel-editor-provider-summary > div { display: flex; min-width: 0; flex-direction: column; }
.channel-editor-provider-summary strong { overflow: hidden; color: var(--admin-ink); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.channel-editor-provider-summary div > span { overflow: hidden; color: var(--admin-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.channel-editor-provider-summary b,
.channel-editor-provider-summary i { font-style: normal; font-weight: 400; }

.channel-editor-nav nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface);
}

.channel-modal-content .channel-editor-nav button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--admin-ink);
  background: transparent;
  font-size: 11px;
  font-weight: 500;
}

.channel-modal-content .channel-editor-nav button:hover { background: color-mix(in srgb, var(--admin-surface-soft) 65%, transparent); }
.channel-modal-content .channel-editor-nav button.is-active { color: var(--admin-ink); background: var(--admin-surface-soft); }
.channel-modal-content .channel-editor-nav button > i { display: inline-flex; width: 27px; height: 27px; flex: 0 0 27px; align-items: center; justify-content: center; border-radius: 6px; color: var(--admin-muted); background: var(--admin-surface-soft); }
.channel-modal-content .channel-editor-nav button.is-active > i { color: var(--admin-primary); background: var(--admin-primary-soft); }

.channel-modal-content .channel-editor-sections {
  gap: 0;
  padding: 0;
}

.channel-modal-content .channel-editor-card {
  padding: 0 0 24px;
  margin: 0 0 24px;
  border: 0;
  border-bottom: 1px solid var(--admin-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.channel-modal-content .channel-editor-card:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.channel-modal-content .channel-editor-card > header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.channel-modal-content .channel-editor-card > header > .channel-section-index {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  color: var(--admin-primary);
  background: var(--admin-primary-soft);
}
.channel-modal-content .channel-editor-card > header > div { min-width: 0; flex: 1; }
.channel-modal-content .channel-editor-card header h3 { font-size: 13px; font-weight: 650; line-height: 1.2; }
.channel-modal-content .channel-editor-card header p { margin-top: 3px; font-size: 11px; line-height: 1.5; }

.channel-modal-content .channel-form-grid { gap: 16px; }
.channel-modal-content .channel-form label > span { font-size: 11px; font-weight: 600; }
.channel-modal-content .channel-form label > small { font-size: 10px; }
.channel-modal-content .channel-form input:not([type="checkbox"]),
.channel-modal-content .channel-form select,
.channel-modal-content .channel-form textarea {
  border: 1px solid var(--admin-line-strong) !important;
  border-radius: 6px !important;
  background: var(--admin-surface) !important;
  box-shadow: none !important;
}
.channel-modal-content .channel-form input:not([type="checkbox"]),
.channel-modal-content .channel-form select { min-height: 36px; }
.channel-modal-content .channel-form input:focus,
.channel-modal-content .channel-form select:focus,
.channel-modal-content .channel-form textarea:focus { border-color: var(--admin-primary) !important; box-shadow: 0 0 0 2px var(--admin-primary-soft) !important; }
.channel-modal-content .channel-switch-card { min-height: 58px; margin-top: 16px; padding: 10px 0; border-width: 1px 0; border-radius: 0; background: transparent; }

.channel-modal-content .admin-modal-footer {
  min-height: 68px;
  gap: 8px;
  padding: 16px 24px !important;
  border-top: 1px solid var(--admin-line) !important;
  background: color-mix(in srgb, var(--admin-surface) 94%, transparent) !important;
}
.channel-modal-content .admin-modal-footer button { min-width: 84px; min-height: 36px; border-radius: 6px !important; }
.channel-modal-content .channel-secondary-btn { border: 1px solid var(--admin-line-strong); background: var(--admin-surface); }
.channel-modal-content .channel-primary-btn { border-color: var(--admin-primary); background: var(--admin-primary); }

@media (max-width: 1023px) {
  .channel-modal-content .channel-form { display: block; }
  .market-admin .channel-modal-content .channel-editor-nav { display: none !important; }
}

@media (max-width: 620px) {
  .market-admin .modal-content.channel-modal-content {
    width: 100vw !important;
    border-left: 0 !important;
    border-radius: 0 !important;
  }
  .channel-modal-content .admin-modal-header { min-height: 74px; padding: 12px 16px !important; }
  .channel-modal-content .channel-form { padding: 16px; }
  .channel-modal-content .channel-editor-sections { gap: 0; padding: 0; }
  .channel-modal-content .channel-editor-card {
    margin: 0 0 20px;
    padding: 0 0 20px;
    border: 0 !important;
    border-bottom: 1px solid var(--admin-line) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .channel-modal-content .channel-editor-card:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0 !important; }
  .channel-modal-content .channel-form-grid,
  .channel-modal-content .channel-form-grid--three { grid-template-columns: minmax(0, 1fr); }
  .channel-modal-content .channel-field-wide { grid-column: auto; }
  .channel-modal-content .admin-modal-footer { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 16px max(12px, var(--admin-safe-bottom)) !important; }
  .channel-modal-content .admin-modal-footer button { width: 100%; }
}

/* Source-audited channel editor details (New API web@9c97e78) */
.channel-modal-content svg {
  display: block;
  width: 16px;
  height: 16px;
}

.channel-modal-content .channel-editor-nav button > span {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
}

.channel-modal-content .channel-editor-nav button > span strong {
  overflow: hidden;
  max-width: 100%;
  color: inherit;
  font-size: 11px;
  font-weight: 550;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-modal-content .channel-editor-nav button > span small {
  overflow: hidden;
  max-width: 100%;
  color: var(--admin-muted);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-modal-content .channel-editor-nav button > b {
  display: block;
  position: relative;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 1.5px solid color-mix(in srgb, var(--admin-muted) 55%, transparent);
  border-radius: 50%;
}

.channel-modal-content .channel-editor-nav button > b.is-complete {
  border-color: var(--admin-primary);
  background: var(--admin-primary);
}

.channel-modal-content .channel-editor-nav button > b.is-complete::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.channel-modal-content .channel-editor-nav button:last-child > b { border: 0; }
.channel-modal-content .channel-editor-nav button:last-child > b::after { content: none; }

.channel-modal-content .channel-section-index svg { width: 16px; height: 16px; }
.channel-modal-content .channel-section-index--success { color: var(--admin-success) !important; background: var(--admin-success-soft) !important; }
.channel-modal-content .channel-section-index--models { color: #7c5ce7 !important; background: color-mix(in srgb, #7c5ce7 11%, transparent) !important; }

.channel-modal-content .channel-inner-card {
  padding: 16px;
  border: 1px solid var(--admin-line) !important;
  border-radius: 8px !important;
  background: var(--admin-surface) !important;
}

.channel-modal-content .channel-inner-card--muted {
  background: color-mix(in srgb, var(--admin-surface-soft) 30%, var(--admin-surface)) !important;
}

.channel-modal-content .channel-model-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-modal-content .channel-inner-card label { gap: 7px; }
.channel-modal-content .channel-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.channel-modal-content .channel-label-row b { color: var(--admin-ink); font-size: 11px; font-weight: 600; }
.channel-modal-content .channel-label-row small { flex: 0 0 auto; padding: 2px 7px; border: 1px solid var(--admin-line); border-radius: 999px; color: var(--admin-muted); background: var(--admin-surface); font-size: 9px; font-weight: 500; }

.channel-modal-content .channel-advanced-section {
  scroll-margin-top: 16px;
}

.channel-modal-content .channel-advanced-trigger {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  color: var(--admin-ink);
  background: var(--admin-surface);
  text-align: left;
}

.channel-modal-content .channel-advanced-trigger:hover { background: color-mix(in srgb, var(--admin-surface-soft) 40%, var(--admin-surface)); }
.channel-modal-content .channel-advanced-trigger > .channel-section-index { width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 6px; color: var(--admin-muted); background: var(--admin-surface-soft); }
.channel-modal-content .channel-advanced-trigger > span:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 1px; }
.channel-modal-content .channel-advanced-trigger strong { font-size: 12px; font-weight: 600; }
.channel-modal-content .channel-advanced-trigger small { overflow: hidden; color: var(--admin-muted); font-size: 10px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.channel-modal-content .channel-advanced-trigger > i { flex: 0 0 auto; color: var(--admin-muted); transition: transform .18s ease; }
.channel-modal-content .channel-advanced-trigger[aria-expanded="true"] > i { transform: rotate(180deg); }

.channel-modal-content .channel-advanced-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}
.channel-modal-content .channel-advanced-content[hidden] { display: none !important; }
.channel-modal-content .channel-advanced-group { display: flex; flex-direction: column; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--admin-line); }
.channel-modal-content .channel-advanced-group:last-child { padding-bottom: 0; border-bottom: 0; }
.channel-modal-content .channel-advanced-group > header { display: flex; align-items: center; gap: 8px; }
.channel-modal-content .channel-advanced-group > header > span { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; color: var(--admin-primary); background: var(--admin-primary-soft); }
.channel-modal-content .channel-advanced-group h4 { margin: 0; color: var(--admin-ink); font-size: 11px; font-weight: 600; }

@media (max-width: 620px) {
  .channel-modal-content .channel-inner-card { padding: 14px; }
  .channel-modal-content .channel-advanced-trigger { min-height: 60px; }
}

/* New API control primitives used by the channel drawer */
.channel-modal-content .channel-native-value { display: none !important; }

.channel-sheet-title-wrap {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.channel-header-action,
.channel-quick-actions button {
  display: inline-flex;
  min-height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 8px;
  color: var(--admin-ink);
  background: var(--admin-surface);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.channel-header-action:hover,
.channel-quick-actions button:hover { background: var(--admin-surface-soft); }
.channel-header-action svg,
.channel-quick-actions button svg { width: 15px; height: 15px; }

.channel-provider-combobox { position: relative; min-width: 0; }
.channel-combobox-trigger {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 8px;
  color: var(--admin-ink);
  background: var(--admin-surface);
  text-align: left;
}
.channel-combobox-trigger > span {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: var(--admin-primary);
  font-size: 10px;
  font-weight: 700;
}
.channel-combobox-trigger > b { min-width: 0; flex: 1; font-size: 13px; font-weight: 450; }
.channel-combobox-trigger > i { color: var(--admin-muted); }

.channel-combobox-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}
.channel-combobox-popover[hidden] { display: none !important; }
.channel-combobox-popover > label { display: block !important; margin-bottom: 5px; }
.channel-combobox-popover input { width: 100%; min-height: 32px !important; }
.channel-combobox-popover [role="listbox"] { display: flex; max-height: 224px; flex-direction: column; gap: 2px; overflow-y: auto; }
.channel-combobox-popover [role="option"] {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  color: var(--admin-ink);
  background: transparent;
  text-align: left;
}
.channel-combobox-popover [role="option"]:hover,
.channel-combobox-popover [role="option"][aria-selected="true"] { background: var(--admin-surface-soft); }
.channel-combobox-popover [role="option"] > span { width: 24px; height: 24px; border-radius: 5px; font-size: 9px; }
.channel-combobox-popover [role="option"] > b { font-size: 12px; font-weight: 500; }

.channel-token-select {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 8px;
  background: var(--admin-surface);
  cursor: text;
}
.channel-token-select:focus-within { border-color: var(--admin-primary); box-shadow: 0 0 0 2px var(--admin-primary-soft); }
.channel-token-chips { display: contents; }
.channel-token-chips > span {
  display: inline-flex;
  min-width: 0;
  min-height: 22px;
  align-items: center;
  gap: 3px;
  padding: 1px 3px 1px 7px;
  border-radius: 4px;
  color: var(--admin-ink);
  background: var(--admin-surface-soft);
  font-size: 11px;
}
.channel-token-chips > span b { overflow: hidden; max-width: 220px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.channel-token-chips button { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 4px; color: var(--admin-muted); background: transparent; }
.channel-token-chips button:hover { color: var(--admin-ink); background: var(--admin-surface-strong); }
.channel-token-chips button svg { width: 11px; height: 11px; }
.channel-token-select > input {
  width: 120px !important;
  min-width: 100px !important;
  min-height: 26px !important;
  flex: 1;
  padding: 0 2px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12px;
}

.channel-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}
.channel-quick-actions > strong { color: var(--admin-ink); font-size: 12px; font-weight: 550; }
.channel-quick-actions > small { color: var(--admin-muted); font-size: 10px; }
.channel-quick-actions > div { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; }
.channel-quick-actions button { min-height: 30px; font-size: 11px; }

.channel-modal-content .channel-editor-nav button > span strong { font-size: 12px; font-weight: 550; }
.channel-modal-content .channel-editor-nav button > span small { font-size: 10px; }
.channel-modal-content .channel-form label > span { font-size: 12px; }
.channel-modal-content .channel-form label > small { font-size: 11px; line-height: 1.5; }
.channel-modal-content .channel-editor-card header h3 { font-size: 14px; }
.channel-modal-content .channel-editor-card header p { font-size: 12px; }
.channel-modal-content .channel-form input:not([type="checkbox"]),
.channel-modal-content .channel-form select { min-height: 36px; border-radius: 8px !important; }
.channel-modal-content .channel-form textarea { border-radius: 8px !important; }
.channel-modal-content .channel-switch-card input[type="checkbox"] {
  display: block !important;
  width: 36px !important;
  min-width: 36px !important;
  height: 20px !important;
  min-height: 20px !important;
  padding: 0 !important;
  border: 1px solid var(--admin-line-strong) !important;
  background-color: var(--admin-surface-strong) !important;
  background-image: none !important;
  opacity: 1 !important;
}
.channel-modal-content .channel-switch-card input[type="checkbox"]:checked {
  border-color: var(--admin-primary) !important;
  background-color: var(--admin-primary) !important;
}

@media (max-width: 620px) {
  .channel-sheet-title-wrap { align-items: flex-start; flex-direction: column; gap: 10px; }
  .channel-header-action { min-height: 32px; }
  .channel-token-chips > span b { max-width: 240px; }
}
