/* ============================================================
   Admin panel — shadcn-svelte dashboard treatment
   Sidebar + sticky header + cards + semantic tables.
   ============================================================ */

.admin-screen-wrap {
  --admin-sidebar-w: var(--desktop-rail-width);
  --admin-header-h: 60px;
  --admin-card-bg:
    linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft)), var(--admin-surface);
  --admin-card-shadow: var(--shadow-soft), inset 0 1px 0 var(--inset-highlight);

  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: var(--admin-bg);
  color: var(--admin-text);
  overflow: hidden;
  overscroll-behavior: contain;
  z-index: 60;
  display: flex;
  flex-direction: row;
  /* Forces a new compositing layer — required for reliable scrolling
     inside position:fixed on iOS Safari. */
  transform: translateZ(0);
}

.admin-sidebar {
  flex: 0 0 var(--admin-sidebar-w);
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 22px 14px;
  border-right: 1px solid var(--admin-border);
  background: var(--rail-bg);
  backdrop-filter: blur(14px);
  box-shadow: inset -1px 0 0 var(--admin-border);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--admin-muted) 34%, var(--admin-border)) transparent;
}

.admin-sidebar::-webkit-scrollbar {
  width: 8px;
}

.admin-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--admin-muted) 34%, var(--admin-border));
  background-clip: padding-box;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--admin-muted) 48%, var(--admin-border));
  background-clip: padding-box;
}

.admin-sidebar > *:not(.admin-sidebar-footer) {
  flex-shrink: 0;
}

.admin-sidebar-brand {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  padding: 2px 10px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text);
}

.admin-sidebar-brand .admin-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.admin-sidebar-brand strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-logo);
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-sidebar-brand small {
  display: block;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--admin-dim);
  padding: 10px 10px 5px;
}

.admin-nav {
  display: grid;
  gap: 2px;
}

.admin-nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease;
}

.admin-nav-item > svg {
  width: 18px;
  height: 18px;
}

.admin-nav-item > span:last-child {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
}

.admin-nav-item .admin-badge.admin-badge-danger {
  display: inline-grid;
  box-sizing: border-box;
  --numeric-badge-optical-y: 0.5px;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0 7px;
  text-align: center;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum";
}

.admin-nav-item:hover {
  background: var(--surface-hover);
  color: var(--admin-text);
}

.admin-nav-item.active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--admin-text);
  font-weight: 600;
}

.admin-nav-item.active::before {
  display: none;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding: 10px 0 0;
  border-top: 1px solid var(--admin-border);
  font-size: 11px;
  color: var(--admin-dim);
  display: grid;
  gap: 10px;
}

.admin-language-switch {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.admin-language-switch > svg {
  color: var(--admin-muted);
}

.admin-language-trigger {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--admin-text);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.admin-language-trigger:focus-visible {
  outline: 2px solid var(--admin-ring);
  outline-offset: 2px;
}

.admin-language-trigger > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.admin-language-trigger strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-language-trigger small {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-version-link {
  order: 2;
  display: grid;
  gap: 2px;
  max-width: 100%;
  overflow: hidden;
  color: var(--admin-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.12s ease;
}

.admin-version-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-version-link:hover {
  color: var(--accent);
}

.admin-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.admin-header {
  flex: 0 0 auto;
  min-height: var(--admin-header-h);
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-bg) 82%, transparent);
  backdrop-filter: blur(14px);
}

.admin-header-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-header-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.admin-header-title small {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-mobile-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-text);
  align-items: center;
  justify-content: center;
}

.admin-main {
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Flex children must NOT shrink — otherwise they collapse to fit the
   container and the main never overflows, breaking scroll. */

.admin-main > * {
  flex-shrink: 0;
}

.admin-section-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  flex-shrink: 0;
  width: 100%;
}

.admin-section-stage:has(.support-admin-layout) {
  flex: 1 1 auto;
  min-height: 0;
}

.admin-card {
  border: 1px solid var(--admin-border);
  background: var(--admin-card-bg);
  border-radius: 12px;
  box-shadow: var(--admin-card-shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.admin-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--admin-border);
  min-width: 0;
}

.admin-card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--admin-text);
  word-break: break-word;
}

.admin-card-head small {
  color: var(--admin-muted);
  font-size: 12px;
  word-break: break-word;
}

.admin-card-body {
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.admin-empty {
  display: grid;
  place-items: center;
  padding: 48px 16px;
  border: 1px dashed var(--admin-border);
  border-radius: 12px;
  background: var(--admin-card-bg);
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-muted {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 560px) {
  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .admin-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  .admin-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.admin-stat-card {
  border: 1px solid var(--admin-border);
  background: var(--admin-card-bg);
  border-radius: 12px;
  box-shadow: var(--admin-card-shadow);
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  min-height: 96px;
}

.admin-stat-card .admin-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 500;
}

.admin-stat-card .admin-stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--admin-text);
}

.admin-stat-card .admin-stat-trend {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard-section {
  margin-top: 20px;
}

.admin-dashboard-section:first-child {
  margin-top: 0;
}

.admin-dashboard-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.admin-dashboard-section-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  letter-spacing: 0;
}

.admin-dashboard-section-head small {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-revenue-panel {
  border: 1px solid var(--admin-border);
  background: var(--admin-card-bg);
  border-radius: 12px;
  box-shadow: var(--admin-card-shadow);
  padding: 16px 18px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.admin-revenue-panel__body {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

@media (min-width: 900px) {
  .admin-revenue-panel__body {
    grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
    gap: 22px;
  }
}

.admin-revenue-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

@media (min-width: 520px) {
  .admin-revenue-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-revenue-kpi {
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-surface-2) 72%, var(--admin-bg));
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-revenue-kpi--wide {
  grid-column: span 2;
}

.admin-revenue-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--admin-muted);
}

.admin-revenue-kpi-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--admin-text);
  line-height: 1.15;
}

.admin-revenue-kpi-sub {
  font-size: 12px;
  color: var(--admin-muted);
  line-height: 1.35;
}

.admin-revenue-kpi-growth {
  font-size: 12px;
  font-weight: 600;
}

.admin-revenue-kpi-growth.is-up {
  color: var(--success-text);
}

.admin-revenue-kpi-growth.is-down {
  color: var(--danger-text);
}

.admin-revenue-chart {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-revenue-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 14px;
  min-width: 0;
}

.admin-revenue-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.admin-revenue-chart-toolbar .admin-revenue-period {
  flex: 1 1 auto;
  justify-content: flex-end;
}

.admin-revenue-granularity {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-revenue-period-btn--compact {
  padding: 4px 9px;
  font-size: 10px;
}

.admin-revenue-period-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.admin-revenue-range-popover {
  z-index: 80;
  width: min(100vw - 24px, 320px);
  padding: 12px 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-text);
  box-shadow: var(--shadow-popover);
}

.admin-revenue-range-popover__title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--admin-text);
}

.admin-revenue-range-popover__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.admin-revenue-rcal {
  margin-top: 2px;
}

.admin-revenue-rcal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.admin-revenue-rcal__heading {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
}

.admin-revenue-rcal__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-surface-2) 70%, var(--admin-bg));
  color: var(--admin-text);
  cursor: pointer;
}

.admin-revenue-rcal__nav:hover {
  background: color-mix(in srgb, var(--admin-surface) 80%, var(--admin-bg));
}

.admin-revenue-rcal__grids {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-revenue-rcal__grid {
  width: 100%;
  border-collapse: collapse;
}

.admin-revenue-rcal__weekrow {
  display: flex;
  width: 100%;
}

.admin-revenue-rcal__headcell {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--admin-muted);
  padding: 2px 0 6px;
  min-width: 0;
}

.admin-revenue-rcal__cell {
  flex: 1;
  padding: 0;
  text-align: center;
  min-width: 0;
}

.admin-revenue-rcal__day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 36px;
  height: 32px;
  margin: 0 auto;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--admin-text);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

.admin-revenue-rcal__day:hover {
  background: color-mix(in srgb, var(--admin-surface-2) 80%, var(--admin-bg));
}

.admin-revenue-rcal__day[data-highlighted] {
  background: color-mix(in srgb, var(--accent) 10%, var(--admin-surface));
}

.admin-revenue-rcal__day[data-selection-start],
.admin-revenue-rcal__day[data-selection-end] {
  background: color-mix(in srgb, var(--accent) 35%, var(--admin-surface));
  color: var(--admin-text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.admin-revenue-rcal__day[data-selected]:not([data-selection-start]):not([data-selection-end]) {
  background: color-mix(in srgb, var(--accent) 14%, var(--admin-surface));
}

.admin-revenue-rcal__day[data-disabled] {
  opacity: 0.35;
  pointer-events: none;
}

.admin-revenue-rcal__day[data-outside-month] {
  opacity: 0.25;
}

.admin-revenue-chart-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-muted);
}

.admin-revenue-period {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--admin-border) 80%, transparent);
  background: color-mix(in srgb, var(--admin-surface-2) 55%, var(--admin-bg));
}

.admin-revenue-period-btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--admin-muted);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.1;
}

.admin-revenue-period-btn:hover {
  color: var(--admin-text);
  background: color-mix(in srgb, var(--admin-surface) 55%, transparent);
}

.admin-revenue-period-btn.is-active {
  color: color-mix(in srgb, var(--accent) 22%, var(--admin-text));
  background: color-mix(in srgb, var(--accent) 12%, var(--admin-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.admin-revenue-chart-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.admin-revenue-chart-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 11px;
  line-height: 1.35;
}

.admin-revenue-chart-meta-sep {
  opacity: 0.55;
}

.admin-revenue-svg-frame {
  position: relative;
  width: 100%;
  min-width: 0;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-bg) 88%, var(--admin-surface-2));
  overflow: hidden;
}

.admin-revenue-svg-frame--chart {
  width: 100%;
}

.admin-revenue-uplot-host {
  width: 100%;
  min-width: 0;
  display: block;
}

/* uPlot ships `width: min-content` on `.uplot`, which can prevent full-width layout */
.admin-revenue-uplot-host .uplot {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.admin-revenue-uplot-host .u-wrap {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

/* uPlot (canvas) — dark admin theme */
.admin-uplot.uplot {
  color: var(--admin-muted);
  font-family: var(--font-sans, system-ui, sans-serif);
}

.admin-uplot .u-title {
  color: var(--admin-text);
}

.admin-revenue-uplot-host .u-legend {
  padding: 10px 12px 8px;
  box-sizing: border-box;
}

.admin-uplot .u-legend {
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-uplot .u-legend th,
.admin-uplot .u-legend td {
  color: var(--admin-text);
}

.admin-uplot .u-inline {
  border-color: var(--admin-border);
}

.admin-revenue-chart-skeleton {
  display: block;
  width: 100%;
  height: min(204px, 36vw);
  min-height: 120px;
}

.admin-revenue-xlabels {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  color: var(--admin-muted);
  padding: 0 2px;
}

.admin-revenue-xlabels span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-panel-dash-card {
  padding-top: 14px;
  padding-bottom: 14px;
}

.admin-panel-dash {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.admin-panel-dash-tiles {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-bg) 65%, var(--admin-surface-2));
}

.admin-panel-dash-tile {
  display: grid;
  gap: 6px;
  padding: 12px 12px 11px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--admin-border) 85%, transparent);
  background: color-mix(in srgb, var(--admin-surface) 92%, var(--admin-bg));
  min-width: 0;
}

.admin-panel-dash-tile--wide {
  grid-column: 1 / -1;
}

.admin-panel-dash-tile-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--admin-muted);
  min-width: 0;
}

.admin-panel-dash-ico {
  display: inline-flex;
  color: color-mix(in srgb, var(--accent) 82%, var(--admin-muted));
  flex-shrink: 0;
}

.admin-panel-dash-ico :global(svg) {
  display: block;
}

.admin-panel-dash-tile-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  color: color-mix(in srgb, var(--accent) 22%, var(--admin-text));
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-panel-dash-tile-value--sm {
  font-size: 16px;
  font-weight: 650;
  white-space: normal;
  line-height: 1.25;
}

.admin-panel-dash-nodes {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.admin-panel-dash-nodes-head {
  display: grid;
  gap: 4px;
  padding: 0 2px;
}

.admin-panel-dash-nodes-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--admin-text);
}

.admin-panel-dash-nodes-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--admin-muted);
}

.admin-panel-dash-nodes-scroll {
  max-height: 240px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-bg) 65%, var(--admin-surface-2));
}

.admin-panel-dash-nodes-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  padding: 10px;
}

.admin-panel-dash-node {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--admin-border) 85%, transparent);
  background: color-mix(in srgb, var(--admin-surface) 92%, var(--admin-bg));
  min-width: 0;
}

.admin-panel-dash-node-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-panel-dash-node-value {
  font-size: 15px;
  font-weight: 700;
  color: color-mix(in srgb, var(--accent) 28%, var(--admin-text));
  font-variant-numeric: tabular-nums;
}

.admin-panel-dash-node-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-muted);
  font-variant-numeric: tabular-nums;
}

.admin-panel-dash-nodes-more {
  margin: 0;
  font-size: 11px;
  color: var(--admin-muted);
  padding: 0 4px;
}

.admin-panel-dash-nodes-empty {
  margin: 0;
  font-size: 12px;
  color: var(--admin-muted);
  padding: 8px 4px 0;
}

.admin-sync-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-surface-2) 70%, var(--admin-bg));
  font-size: 12px;
  color: var(--admin-muted);
}

.admin-sync-strip strong {
  color: var(--admin-text);
  font-weight: 600;
}

.admin-stat-skeleton-card {
  border: 1px solid var(--admin-border);
  background: var(--admin-card-bg);
  border-radius: 12px;
  box-shadow: var(--admin-card-shadow);
  padding: 16px 18px;
  display: grid;
  gap: 10px;
  min-height: 96px;
}

.admin-stat-skeleton-wide {
  grid-column: span 1;
}

@media (min-width: 560px) {
  .admin-stat-skeleton-wide {
    grid-column: span 2;
  }
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-toolbar-users {
  display: grid;
  grid-template-columns: minmax(260px, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: var(--admin-card-bg);
  box-shadow: var(--admin-card-shadow);
}

.admin-toolbar-card {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: var(--admin-card-bg);
  box-shadow: var(--admin-card-shadow);
}

.admin-toolbar-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-toolbar-search-actions {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.admin-toolbar-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(96px, auto);
  align-items: end;
  gap: 8px;
}

.admin-toolbar-field {
  display: grid;
  align-items: start;
  gap: 6px;
  min-width: 0;
}

.admin-toolbar-field-label {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.admin-toolbar-select {
  height: 36px;
  min-width: 0;
}

.admin-toolbar-summary {
  display: grid;
  min-height: 36px;
  min-width: 96px;
  align-content: center;
  justify-items: end;
  gap: 2px;
  padding: 0 2px;
  white-space: nowrap;
}

.admin-toolbar-summary strong {
  color: var(--admin-text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
}

@media (max-width: 900px) {
  .admin-toolbar-controls {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .admin-toolbar-summary {
    justify-items: start;
  }
}

@media (max-width: 560px) {
  .admin-toolbar-search,
  .admin-toolbar-search-actions,
  .admin-toolbar-card,
  .admin-toolbar-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-toolbar-summary {
    justify-items: start;
  }
}

.admin-table-wrap {
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: var(--admin-card-bg);
  box-shadow: var(--admin-card-shadow);
  overflow: hidden;
}

.admin-table-wrap > .admin-card-head {
  border-bottom: 1px solid var(--admin-border);
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.admin-table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--admin-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--admin-surface-2) 72%, var(--admin-bg));
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}

.admin-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
  color: var(--admin-text);
}

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

.admin-table tbody tr {
  transition: background 0.08s ease;
}

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

.admin-table td.admin-cell-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.admin-table td.admin-cell-actions {
  text-align: right;
  white-space: nowrap;
}

.admin-table td.admin-cell-wrap {
  white-space: normal;
  max-width: 320px;
  word-break: break-word;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-table td.admin-cell-id {
  color: var(--admin-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  width: 80px;
}

.admin-table tbody tr.is-clickable {
  cursor: pointer;
}

.admin-user-list {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.admin-user-list > li {
  border-bottom: 1px solid var(--admin-border);
}

.admin-user-list > li:last-child {
  border-bottom: 0;
}

.admin-user-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(72px, max-content) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--admin-text);
  /* Card height = avatar (36px) + padding-y * 2 = 52px. */
  padding: 8px 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.admin-user-row:hover {
  background: color-mix(in srgb, var(--admin-elev) 60%, transparent);
}

.admin-user-row:focus-visible {
  outline: 2px solid var(--admin-ring);
  outline-offset: -2px;
}

.admin-user-premium-col {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

.admin-user-premium-badge {
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.admin-user-premium-placeholder {
  color: var(--admin-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.admin-user-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.admin-user-tertiary {
  color: var(--admin-dim);
  font-size: 11px;
  white-space: nowrap;
}

.admin-avatar.admin-avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 11px;
}

@media (max-width: 480px) {
  /* On very narrow screens, drop the date but keep the badge inline so the
     row still fits within `avatar + padding` height. */
  .admin-user-tertiary {
    display: none;
  }

  .admin-user-row {
    gap: 10px;
  }
}

.admin-avatar {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--accent) 16%, var(--admin-surface-2));
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.admin-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-avatar-lg {
  width: 58px;
  height: 58px;
  font-size: 16px;
}

.admin-user-main,
.admin-user-meta,
.admin-user-profile-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-user-main strong,
.admin-user-profile-head strong {
  overflow: hidden;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-main small,
.admin-user-profile-head small,
.admin-user-meta span {
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-meta strong {
  overflow: hidden;
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-status {
  justify-self: end;
}

.admin-user-profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-mini-list {
  display: grid;
  gap: 0;
}

.admin-mini-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--admin-border);
}

.admin-mini-list-row:last-child {
  border-bottom: 0;
}

.admin-mini-list-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-mini-list-row strong {
  overflow: hidden;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-mini-list-row small {
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 0;
}

.admin-pagination .admin-pagination-meta {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-pagination-buttons {
  display: flex;
  gap: 6px;
}

.admin-select {
  width: 100%;
  appearance: auto;
}

.admin-textarea,
.admin-screen-wrap textarea,
.admin-dialog textarea {
  width: 100%;
  min-height: 110px;
  border-radius: 10px;
  border: 1px solid var(--admin-border-strong);
  background: var(--admin-bg);
  color: var(--admin-text);
  padding: 12px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.admin-textarea:focus,
.admin-screen-wrap textarea:focus,
.admin-dialog textarea:focus {
  border-color: var(--admin-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.admin-form-row.admin-form-row-3 {
  grid-template-columns: minmax(180px, 1.1fr) minmax(160px, 0.8fr) minmax(140px, 0.6fr);
}

.admin-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--admin-muted);
  font-weight: 500;
}

.admin-form label > span {
  color: var(--admin-text);
  font-weight: 500;
}

.admin-form label > small {
  color: var(--admin-dim);
  font-weight: 400;
}

.admin-switch.admin-switch-field {
  align-self: end;
  min-height: 36px;
  display: flex;
}

/* ============================================================
   Admin skeletons (users list, payments / logs / promos / ads
   tables). Rendered while data is loading to soften the empty
   state. Kept aria-hidden in markup; purely decorative.
   ============================================================ */

.admin-skeleton {
  display: inline-block;
  background: linear-gradient(
    90deg,
    var(--admin-surface-2) 0%,
    color-mix(in srgb, var(--admin-elev) 65%, transparent) 50%,
    var(--admin-surface-2) 100%
  );
  background-size: 200% 100%;
  border-radius: 6px;
  animation: admin-skeleton-shimmer 1.2s ease-in-out infinite;
}

.admin-skeleton-line {
  display: block;
  width: 100%;
  height: 10px;
  border-radius: 4px;
}

.admin-skeleton-line-strong {
  height: 12px;
  width: 60%;
}

.admin-skeleton-line-soft {
  height: 9px;
  width: 40%;
  opacity: 0.7;
}

.admin-skeleton-line-short {
  width: 50%;
}

.admin-skeleton-line-tiny {
  width: 32%;
}

.admin-skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.admin-skeleton-badge {
  width: 64px;
  height: 18px;
  border-radius: 999px;
}

.admin-user-row-skeleton {
  cursor: default;
  pointer-events: none;
}

.admin-user-row-skeleton .admin-user-main {
  display: grid;
  gap: 6px;
}

.admin-user-row-skeleton .admin-user-side {
  gap: 8px;
}

.admin-table-skeleton td {
  padding: 12px 16px;
}

@keyframes admin-skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-skeleton {
    animation: none;
  }
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 900px) {
  .admin-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.admin-meta-list li {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--admin-border);
  font-size: 13px;
}

.admin-meta-list li:last-child {
  border-bottom: 0;
}

.admin-meta-list li > span {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-meta-list li > strong {
  font-weight: 500;
  color: var(--admin-text);
  word-break: break-word;
}

.admin-accordion {
  display: grid;
  gap: 10px;
}

.admin-accordion-item.admin-card {
  display: block;
  min-width: 0;
}

.admin-accordion-header {
  margin: 0;
  display: block;
}

.admin-accordion-trigger {
  appearance: none;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  color: var(--admin-text);
  cursor: pointer;
  font: inherit;
  width: 100%;
  transition: background 0.12s ease;
  outline: none;
}

.admin-accordion-trigger:hover {
  background: var(--admin-surface-2);
}

.admin-accordion-trigger:focus-visible {
  background: var(--admin-surface-2);
  box-shadow: inset 0 0 0 2px var(--admin-ring);
}

.admin-accordion-trigger[data-state="open"] {
  border-bottom: 1px solid var(--admin-border);
}

.admin-accordion-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
  word-break: break-word;
  min-width: 0;
}

.admin-accordion-meta {
  color: var(--admin-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.admin-accordion-chev {
  transition: transform 0.2s ease;
  color: var(--admin-muted);
  flex: 0 0 auto;
}

.admin-accordion-trigger[data-state="open"] .admin-accordion-chev {
  transform: rotate(90deg);
}

.admin-accordion-content {
  overflow: hidden;
}

.admin-accordion-content[data-state="open"] {
  animation: admin-accordion-open 140ms cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-accordion-content[data-state="closed"] {
  animation: admin-accordion-close 110ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes admin-accordion-open {
  from {
    height: 0;
    opacity: 0.72;
  }

  to {
    height: var(--bits-accordion-content-height);
    opacity: 1;
  }
}

@keyframes admin-accordion-close {
  from {
    height: var(--bits-accordion-content-height);
    opacity: 1;
  }

  to {
    height: 0;
    opacity: 0.72;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-accordion-content[data-state="open"],
  .admin-accordion-content[data-state="closed"] {
    animation: none;
  }
}

@media (max-width: 720px) {
  .admin-accordion-trigger {
    padding: 12px 14px;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title chev"
      "meta meta";
  }

  .admin-accordion-title {
    grid-area: title;
  }

  .admin-accordion-chev {
    grid-area: chev;
  }

  .admin-accordion-meta {
    grid-area: meta;
    white-space: normal;
    font-size: 11px;
  }
}

.admin-setting {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--admin-border);
  align-items: center;
}

.admin-webhook-hint {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--info) 7%, transparent);
}

.admin-webhook-hint-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-webhook-hint-meta strong {
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-webhook-hint-meta small {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-webhook-value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-webhook-value code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--admin-bg) 82%, var(--admin-surface-2));
  color: var(--admin-text);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-webhook-copy {
  flex: 0 0 auto;
}

.admin-settings-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  margin: 14px 18px 4px;
  padding: 12px 14px;
  border: 1px solid var(--warning-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--warning) 10%, var(--admin-surface));
  color: var(--admin-text);
}

.admin-settings-warning > svg {
  color: var(--warning);
}

.admin-settings-warning-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-settings-warning-copy strong {
  font-size: 13px;
  line-height: 1.3;
}

.admin-settings-warning-copy p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.45;
}

.admin-settings-warning-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

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

.admin-settings-field-groups {
  display: grid;
  gap: 10px;
  padding: 12px 18px 18px;
}

.admin-settings-field-group {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--admin-border) 88%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-bg) 52%, transparent);
}

.admin-settings-field-group.is-dirty {
  border-color: color-mix(in srgb, var(--warning-border) 74%, var(--admin-border));
}

.admin-settings-field-group-head {
  display: grid;
  gap: 3px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--admin-border);
  background: color-mix(in srgb, var(--admin-surface-2) 56%, transparent);
}

.admin-settings-field-group-head strong {
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

.admin-settings-field-group-head small {
  color: var(--admin-muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-settings-field-group-body .admin-setting {
  padding-inline: 14px;
}

.admin-settings-field-group-body .admin-setting:last-child {
  border-bottom: 0;
}

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

.admin-setting.is-overridden {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.admin-setting.is-dirty {
  background: color-mix(in srgb, var(--warning) 7%, transparent);
}

.admin-setting-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-setting-meta strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  word-break: break-word;
}

.admin-setting-meta code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--admin-dim);
  word-break: break-all;
  overflow-wrap: anywhere;
}

.admin-setting-meta small {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.admin-setting-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.admin-icon-picker-trigger {
  min-width: 180px;
  justify-content: flex-start;
}

.admin-icon-picker-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-icon-picker-dialog {
  width: min(100%, 760px);
}

.admin-icon-picker-body {
  display: grid;
  gap: 18px;
}

.admin-icon-picker-current {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--surface-sheen), transparent),
    color-mix(in srgb, var(--admin-surface-2) 86%, transparent);
}

.admin-icon-picker-current-preview {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--admin-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-muted));
  color: var(--admin-text);
}

.admin-icon-picker-current-meta {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.admin-icon-picker-current-meta small {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-icon-picker-current-meta strong {
  overflow: hidden;
  color: var(--admin-text);
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-icon-picker-toolbar {
  display: grid;
  gap: 10px;
}

.admin-icon-picker-search {
  position: relative;
  display: block;
}

.admin-icon-picker-search > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-muted);
  pointer-events: none;
}

.admin-icon-picker-search .input {
  width: 100%;
  padding-left: 36px;
}

.admin-icon-picker-scroll {
  border-radius: 10px;
}

.admin-icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 2px 4px 4px 0;
}

.admin-icon-picker-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--admin-text);
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.admin-icon-picker-option > svg {
  justify-self: center;
  color: var(--admin-muted);
}

.admin-icon-picker-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-icon-picker-option:hover,
.admin-icon-picker-option.active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--admin-border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-muted));
}

.admin-icon-picker-option.active > svg {
  color: var(--accent);
}

@media (max-width: 640px) {
  .admin-icon-picker-current {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .admin-icon-picker-current > .admin-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .admin-icon-picker-current-preview {
    width: 44px;
    height: 44px;
  }

  .admin-icon-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

.admin-setting-control .admin-color {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface-2);
  padding: 0;
  cursor: pointer;
}

.admin-setting-switch {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 500;
}

.admin-translations-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.admin-translations-search {
  position: relative;
  display: block;
  min-width: 0;
}

.admin-translations-search > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  color: var(--admin-muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.admin-translations-search .input {
  width: 100%;
  padding-left: 36px;
}

.admin-translations-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-translations-path {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.admin-translations-skeleton {
  display: grid;
  gap: 10px;
}

.admin-translation-skeleton-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
}

.admin-translations-language-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.2fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.admin-translations-language-head {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
}

.admin-translations-language-head > svg {
  grid-row: span 2;
  color: var(--admin-muted);
}

.admin-translations-language-head strong {
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 700;
}

.admin-translations-language-head small {
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-translations-language-list {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-translations-language-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-size: 11px;
}

.admin-translations-language-chip.is-custom {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--admin-border));
}

.admin-translations-language-chip strong,
.admin-translations-language-chip code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-translations-language-chip code {
  color: var(--admin-muted);
  font-size: 10px;
}

.admin-translations-language-add {
  display: grid;
  grid-template-columns: minmax(100px, 150px) auto;
  gap: 8px;
  align-items: center;
}

.admin-translations-audience-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.admin-translations-audience-tabs button {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: transparent;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.admin-translations-audience-tabs button:hover,
.admin-translations-audience-tabs button.is-active {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--admin-border));
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--admin-text);
}

.admin-translations-audience-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-translations-audience-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 0 2px;
}

.admin-translations-audience-head span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.admin-translations-audience-head strong {
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 750;
}

.admin-translations-audience-head small {
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-translation-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-translation-group-description {
  margin: 12px 18px 0;
  font-size: 12px;
  line-height: 1.45;
}

.admin-translation-group-skeleton {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
}

.admin-translation-list {
  display: grid;
  min-width: 0;
}

.admin-translation-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.35fr);
  gap: 20px;
  align-items: start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-translation-row:last-child {
  border-bottom: 0;
}

.admin-translation-row-skeleton {
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.35fr);
  padding: 10px 0;
}

.admin-translation-row-skeleton > span {
  display: grid;
  gap: 8px;
}

.admin-translation-locales {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-translation-locale {
  display: grid;
  min-width: 0;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-bg) 70%, transparent);
  overflow: hidden;
}

.admin-translation-locale.is-overridden {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--admin-border));
  background: color-mix(in srgb, var(--accent) 6%, var(--admin-bg));
}

.admin-translation-locale.is-dirty {
  border-color: color-mix(in srgb, var(--warning-border) 72%, var(--admin-border));
  background: color-mix(in srgb, var(--warning) 7%, var(--admin-bg));
}

.admin-translation-locale-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-translation-locale-toggle:hover,
.admin-translation-locale-toggle:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.admin-translation-locale-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.admin-translation-locale-main strong {
  min-width: 0;
  overflow: hidden;
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-translation-locale-main code {
  color: var(--admin-muted);
  font-size: 10px;
}

.admin-translation-locale-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.admin-translation-locale.is-expanded .admin-accordion-chev {
  transform: rotate(90deg);
}

.admin-translation-locale-toggle small {
  grid-column: 1 / -1;
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-translation-locale-body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 0 11px 11px;
}

.admin-translation-textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
}

.admin-translation-base {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-translation-base small {
  color: var(--admin-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-translation-base span {
  display: -webkit-box;
  max-height: 4.2em;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

@media (max-width: 860px) {
  .admin-translation-row,
  .admin-translations-toolbar,
  .admin-translations-language-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-translations-actions,
  .admin-translations-language-add {
    justify-content: flex-start;
  }

  .admin-translations-language-add {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.admin-tabs {
  display: inline-flex;
  border-bottom: 1px solid var(--admin-border);
  gap: 2px;
}

.admin-tabs button {
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.admin-tabs button.active {
  color: var(--admin-text);
  border-bottom-color: var(--accent);
}

/* Admin dialogs don't share the user-facing bottom-nav, so reset the .dialog
   wrapper's padding (which reserves space for the mobile nav) and let the
   card use the full viewport for its scroll area. */

.admin-dialog {
  max-height: 100%;
  /* Keep admin dialogs readable on desktop: base .dialog-card uses min(100%, 520px);
     this rule must not stretch the card to full viewport width. */
  width: min(100%, 520px);
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Short create/edit forms (promo, ad campaign, etc.): narrower card on large screens. */
.admin-dialog.admin-dialog-compact {
  width: min(100%, 400px);
}

/* Optional grouping inside compact admin dialogs */
.admin-dialog-compact .admin-dialog-form-section {
  display: grid;
  gap: 12px;
}

.admin-dialog-compact .admin-dialog-form-section + .admin-dialog-form-section {
  padding-top: 14px;
  margin-top: 2px;
  border-top: 1px solid var(--admin-border);
}

/* User-detail dialog: constrain on desktop and lay out as a two-column
   sidebar (profile facts) + main content (tabs). On mobile it stacks. */

.admin-user-dialog {
  width: min(100%, 1040px);
  max-height: min(100%, 760px);
}

.admin-user-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.admin-payment-dialog {
  width: min(100%, 980px);
  max-height: min(100%, 760px);
}

.admin-payment-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.admin-payment-aside,
.admin-payment-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.admin-payment-summary {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px 14px 16px;
  border-radius: 12px;
  background: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  min-width: 0;
}

.admin-payment-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 16%, var(--admin-surface));
  color: var(--accent);
}

.admin-payment-summary-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-payment-summary-meta strong {
  color: var(--admin-text);
  font-size: 17px;
  font-weight: 750;
  word-break: break-word;
}

.admin-payment-summary-meta small {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.admin-payment-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

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

.admin-payment-stat {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 2px 8px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
}

.admin-payment-stat > svg {
  grid-row: span 2;
  color: var(--admin-muted);
}

.admin-payment-stat span {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-payment-stat strong {
  min-width: 0;
  overflow: hidden;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-payment-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-surface-2) 55%, var(--admin-bg));
}

.admin-payment-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--admin-muted);
}

.admin-payment-panel-head h3 {
  margin: 0;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 700;
}

.admin-payment-meta-list li {
  grid-template-columns: 138px minmax(0, 1fr) auto;
}

.admin-payment-meta-list li > .admin-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
}

@media (max-width: 560px) {
  .admin-payment-meta-list li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
  }

  .admin-payment-meta-list li > span {
    grid-column: 1 / -1;
  }
}

.admin-user-aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.admin-user-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.admin-user-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  min-width: 0;
}

.admin-user-stat span {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-user-stat strong {
  color: var(--admin-text);
  font-size: 15px;
  font-weight: 700;
  word-break: break-word;
}

.admin-link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  min-width: 0;
}

.admin-link-row-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-link-row-label {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-link-row-url {
  color: var(--admin-text);
  font-family: var(--font-mono);
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.admin-link-row-url:hover {
  color: var(--accent);
  text-decoration: underline;
}

.admin-meta-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-traffic-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.admin-traffic-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-surface-2) 54%, var(--admin-bg));
}

.admin-traffic-card-premium {
  border-color: var(--info-border);
}

.admin-traffic-card-warning {
  border-color: var(--warning-border);
}

.admin-traffic-head,
.admin-traffic-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.admin-traffic-head span {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-traffic-head strong {
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.admin-traffic-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--admin-bg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--admin-border);
}

.admin-traffic-bar span {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ffffff));
}

.admin-traffic-bar-premium span {
  background: linear-gradient(90deg, var(--info), color-mix(in srgb, var(--info) 64%, #ffffff));
}

.admin-traffic-card-warning .admin-traffic-bar span {
  background: linear-gradient(90deg, var(--warning), var(--danger));
}

.admin-traffic-meta {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
}

@media (min-width: 860px) {
  .admin-user-dialog-body {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }

  .admin-payment-dialog-body {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }

  .admin-user-aside {
    position: sticky;
    top: 0;
  }

  .admin-payment-aside {
    position: sticky;
    top: 0;
  }
}

.admin-tariff-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 720px) {
  .admin-tariff-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .admin-tariff-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.admin-tariff-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface-2);
  padding: 14px;
}

.admin-tariff-card.is-disabled {
  opacity: 0.72;
}

.admin-tariff-top,
.admin-tariff-title,
.admin-tariff-actions,
.admin-editor-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-tariff-top {
  justify-content: space-between;
}

.admin-tariff-title {
  min-width: 0;
  flex-wrap: wrap;
}

.admin-tariff-title strong {
  color: var(--admin-text);
  font-size: 15px;
}

.admin-tariff-card code {
  display: block;
  margin-top: 4px;
  color: var(--admin-dim);
  font-family: var(--font-mono);
  font-size: 11px;
}

.admin-tariff-card p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-tariff-facts {
  display: grid;
  gap: 6px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-tariff-facts span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-tariff-actions {
  flex-wrap: wrap;
}

.admin-tariff-catalog-bar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-currency-input {
  width: 120px;
  text-transform: uppercase;
}

.admin-provider-currency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.admin-provider-currency {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface-2);
}

.admin-provider-currency.is-supported {
  border-color: color-mix(in srgb, var(--success-border) 70%, var(--admin-border));
}

.admin-provider-currency.is-unavailable {
  opacity: 0.72;
}

.admin-provider-currency div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-provider-currency strong,
.admin-provider-currency small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-provider-currency strong {
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 700;
}

.admin-provider-currency small {
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-tariff-settings-card {
  margin-top: 14px;
}

.admin-tariff-settings-form {
  gap: 14px;
}

.admin-trial-settings-body .admin-settings-field-groups {
  padding: 0;
}

.admin-trial-settings-groups .admin-settings-field-group-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.admin-settings-field-group-head-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-trial-setting-row .input,
.admin-trial-setting-row .admin-select-trigger {
  width: 100%;
}

.admin-trial-squad-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.admin-trial-squad-control .admin-select-trigger,
.admin-trial-squad-control .admin-chip-list {
  grid-column: 1 / -1;
}

.admin-tariff-settings-save-row {
  justify-content: flex-end;
  margin-bottom: 12px;
}

.admin-field-label-compact {
  gap: 8px;
}

.admin-field-label-compact .input,
.admin-field-label-compact .admin-select-trigger {
  width: 100%;
}

.admin-legacy-tariff-table {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface-2);
}

.admin-legacy-tariff-row {
  display: grid;
  grid-template-columns:
    minmax(58px, 0.7fr) minmax(74px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr)
    minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--admin-border);
}

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

.admin-legacy-tariff-head {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-legacy-tariff-row strong {
  color: var(--admin-text);
  font-size: 13px;
}

.admin-legacy-tariff-row .input {
  width: 100%;
  min-width: 0;
}

.admin-legacy-traffic-row {
  margin-top: 14px;
}

.admin-tariff-dialog {
  width: min(980px, calc(100vw - 32px));
}

.admin-editor-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--admin-surface-2) 62%, transparent);
  padding: 12px;
}

.admin-editor-section-head {
  justify-content: space-between;
  min-height: 28px;
}

.admin-editor-section-head strong {
  color: var(--admin-text);
  font-size: 13px;
}

.admin-editor-section-head > div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Section title block: stacks `<strong>` heading + `<small>` description.
   Higher specificity than `.admin-editor-section-head > div` (which would
   otherwise force flex-row on the wrapper). */

.admin-editor-section-head > .admin-editor-section-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 200px;
  min-width: 0;
}

.admin-editor-section-head > .admin-editor-section-title small {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Column headers above an `.admin-row-editor` list — visually distinct,
   inherits the same grid template as input rows so columns line up. */

.admin-row-editor-line.admin-row-editor-header {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 4px;
}

.admin-row-editor-line.admin-row-editor-header span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-editor {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-row-editor-line {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(110px, 1fr) 32px;
  gap: 8px;
  align-items: center;
}

.admin-row-editor-line.admin-row-editor-4 {
  grid-template-columns: minmax(80px, 0.8fr) minmax(100px, 1fr) minmax(100px, 1fr) 32px;
}

.admin-row-editor-line.admin-row-editor-6 {
  grid-template-columns:
    minmax(72px, 0.8fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(120px, 1fr)
    minmax(120px, 1fr) 32px;
}

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

.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

@media (max-width: 1023px) {
  .admin-screen-wrap {
    --admin-header-h: 56px;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    flex: 0 0 auto;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-strong);
  }

  .admin-screen-wrap.is-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay-scrim);
    z-index: 70;
    border: 0;
    cursor: pointer;
  }

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

  .admin-header {
    padding: 8px 16px;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: row;
    grid-auto-rows: auto;
    align-content: center;
    gap: 6px;
    min-height: var(--admin-header-h);
  }

  .admin-header-actions {
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .admin-header-actions::-webkit-scrollbar {
    display: none;
  }

  .admin-main {
    padding: 16px;
  }
}

@media (max-width: 720px) {
  .admin-setting {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px 14px;
  }

  .admin-webhook-hint {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
  }

  .admin-webhook-value {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-webhook-value code {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .admin-webhook-copy {
    align-self: flex-start;
  }

  .admin-settings-warning {
    grid-template-columns: auto minmax(0, 1fr);
    margin: 12px 14px 4px;
  }

  .admin-settings-warning-link {
    grid-column: 2;
    justify-self: start;
  }

  .admin-settings-field-groups {
    padding: 10px 14px 14px;
  }

  .admin-settings-field-group-body .admin-setting {
    padding-inline: 12px;
  }

  .admin-card-head {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    padding: 12px 14px;
  }

  .admin-card-head > .admin-editor-section-actions {
    justify-self: start;
    width: 100%;
  }

  .admin-settings-field-group-head,
  .admin-trial-settings-groups .admin-settings-field-group-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-settings-field-group-head > .admin-badge {
    justify-self: start;
  }

  .admin-setting-meta strong {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-card-body {
    padding: 14px;
  }

  .admin-tariff-card {
    padding: 12px;
  }

  .admin-legacy-tariff-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-legacy-tariff-head {
    display: none;
  }

  .admin-tariff-actions .admin-btn {
    flex: 1 1 calc(50% - 4px);
  }

  .admin-tariff-actions .admin-btn[aria-label] {
    flex: 0 0 auto;
  }

  /* (legacy three-row user-row layout removed in favour of the compact
     single-row layout defined above) */

  .admin-user-meta strong {
    font-size: 11px;
  }

  .admin-form-row.admin-form-row-3,
  .admin-package-columns,
  .admin-row-editor-line,
  .admin-row-editor-line.admin-row-editor-4,
  .admin-row-editor-line.admin-row-editor-6 {
    grid-template-columns: 1fr;
  }

  .admin-dialog-actions {
    justify-content: stretch;
    flex-direction: column-reverse;
  }

  .admin-dialog-actions .admin-btn {
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tbody td {
    display: block;
    padding: 6px 16px;
    border: 0;
  }

  .admin-table tbody tr {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--admin-border);
  }

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

  .admin-table tbody td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 110px;
    color: var(--admin-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 8px;
  }

  .admin-table td.admin-cell-actions {
    text-align: left;
  }
}

/* ============================================================
   shadcn-svelte primitives: Tabs / Select / Switch / Label
   bits-ui exposes data-state attributes; styling here matches
   shadcn-svelte defaults adapted to the dark admin palette.
   ============================================================ */

.admin-tabs-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.admin-tabs-list {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  overflow-x: auto;
  scrollbar-width: none;
  flex: 0 0 auto;
}

.admin-tabs-list::-webkit-scrollbar {
  display: none;
}

.admin-tabs-trigger {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--admin-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    box-shadow 0.12s ease;
  outline: none;
}

.admin-tabs-trigger:hover {
  color: var(--admin-text);
}

.admin-tabs-trigger[data-state="active"] {
  background: var(--admin-surface);
  color: var(--admin-text);
  box-shadow: var(--shadow-soft);
}

.admin-tabs-trigger:focus-visible {
  box-shadow: 0 0 0 2px var(--admin-ring);
}

.admin-tabs-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  outline: none;
}

.admin-tabs-content[data-state="inactive"] {
  display: none;
}

.admin-user-tabs-root {
  gap: 0;
}

.admin-user-tabs-root .admin-tabs-list {
  gap: 2px;
  padding: 4px 4px 0;
  border-radius: 10px 10px 0 0;
  background: color-mix(in srgb, var(--admin-surface-2) 74%, var(--admin-bg));
  border-bottom: 0;
  width: fit-content;
  max-width: 100%;
}

.admin-user-tabs-root .admin-tabs-trigger {
  padding: 8px 14px 9px;
  border-radius: 7px 7px 0 0;
}

.admin-user-tabs-root .admin-tabs-trigger[data-state="active"] {
  position: relative;
  z-index: 1;
  box-shadow:
    0 -1px 0 var(--admin-border),
    1px 0 0 var(--admin-border),
    -1px 0 0 var(--admin-border),
    0 1px 0 var(--admin-surface);
}

.admin-user-tabs-root .admin-tabs-content {
  margin-top: -1px;
  padding: 16px;
  border: 1px solid var(--admin-border);
  border-radius: 0 10px 10px 10px;
  background: var(--admin-surface);
}

/* Switch (bits-ui Switch.Root + Thumb) */

.admin-switch-root {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--admin-border);
  background: var(--admin-elev);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
  outline: none;
}

.admin-switch-root[data-state="checked"] {
  background: color-mix(in srgb, var(--success) 82%, var(--admin-elev));
  border-color: color-mix(in srgb, var(--success) 52%, transparent);
}

.admin-switch-root:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

.admin-switch-root:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-switch-thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  margin-left: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s ease;
}

.admin-switch-root[data-state="checked"] .admin-switch-thumb {
  transform: translateX(18px);
}

/* Select (bits-ui Select.Root + Trigger + Content + Item) */

.admin-select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--admin-border-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-bg) 82%, var(--admin-surface-2));
  color: var(--admin-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.admin-select-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-select-trigger:hover {
  border-color: var(--admin-border-strong);
}

.admin-select-trigger:focus-visible,
.admin-select-trigger[data-state="open"] {
  border-color: var(--admin-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.admin-select-icon {
  color: var(--admin-muted);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

.admin-select-trigger[data-state="open"] .admin-select-icon {
  transform: rotate(180deg);
}

.admin-select-content {
  z-index: 90;
  min-width: var(--bits-select-anchor-width);
  max-height: var(--bits-select-content-available-height, 320px);
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft)), var(--admin-surface);
  padding: 4px;
  box-shadow: var(--shadow-popover);
  outline: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.admin-select-viewport {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: inherit;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--admin-muted) 34%, var(--admin-border)) transparent;
}

.admin-select-viewport::-webkit-scrollbar {
  width: 8px;
}

.admin-select-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.admin-select-viewport::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--admin-muted) 34%, var(--admin-border));
  background-clip: padding-box;
}

.admin-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--admin-text);
  cursor: pointer;
  outline: none;
  user-select: none;
}

.admin-select-item[data-highlighted],
.admin-select-item:hover {
  background: var(--admin-surface-2);
}

.admin-select-item-check {
  color: var(--accent);
  opacity: 0;
}

.admin-select-item[data-state="checked"] .admin-select-item-check {
  opacity: 1;
}

.admin-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface-2);
  color: var(--admin-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.admin-chip:hover {
  border-color: var(--admin-border-strong);
}

/* Label primitive (bits-ui Label.Root) */

.admin-field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--admin-muted);
  font-weight: 500;
  min-width: 0;
}

.admin-field-label > span {
  color: var(--admin-text);
  font-weight: 500;
  font-size: 13px;
}

.admin-field-label > small {
  color: var(--admin-dim);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.45;
}

.admin-field-label > small code,
.admin-editor-section-title small code {
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--admin-elev) 70%, transparent);
  color: var(--admin-text);
  font-family: var(--font-mono);
  font-size: 11px;
}

.admin-field-label > small b,
.admin-editor-section-title small b {
  color: var(--admin-text);
  font-weight: 600;
}

/* Action rows in dialogs */

.admin-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  min-width: 0;
}

.admin-action-row-bordered {
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--admin-surface-2);
}

.admin-action-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
  color: var(--admin-text);
  cursor: pointer;
}

.admin-action-label > strong {
  font-weight: 600;
}

.admin-action-label > small {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.4;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.admin-user-quick-actions {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(260px, 1.25fr);
  gap: 12px;
  align-items: end;
}

.admin-reset-trial-btn {
  width: 100%;
  height: 36px;
}

.admin-extend-field {
  gap: 6px;
  min-width: 0;
}

.admin-action-inline-field {
  gap: 6px;
}

.admin-extend-control {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  align-items: stretch;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--admin-border-strong);
  border-radius: 8px;
  background: var(--admin-bg);
  overflow: hidden;
}

.admin-extend-control:focus-within {
  border-color: var(--admin-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.admin-input-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.admin-message-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.admin-confirm-message-preview {
  max-height: min(280px, 45vh);
  overflow: hidden;
  padding: 12px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .admin-action-grid,
  .admin-user-quick-actions,
  .admin-message-actions,
  .admin-input-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-extend-control {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .admin-extend-control .input,
  .admin-extend-control .admin-btn {
    height: 36px;
  }

  .admin-extend-control .admin-btn {
    border-width: 1px 0 0;
  }
}

/* Two-column variant of admin-form-row */

.admin-form-row.admin-form-row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .admin-form-row.admin-form-row-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* User summary header inside the user dialog */

.admin-user-summary {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  padding: 14px 14px 16px;
  border-radius: 12px;
  background: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  min-width: 0;
}

.admin-user-summary-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-user-summary-meta strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--admin-text);
  word-break: break-word;
}

.admin-user-summary-meta small {
  color: var(--admin-muted);
  font-size: 12px;
  word-break: break-word;
}

.admin-user-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.admin-avatar.admin-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 18%, var(--admin-surface));
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
  flex: 0 0 auto;
}

.admin-avatar.admin-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-subsection-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-separator {
  height: 1px;
  background: var(--admin-border);
  border: 0;
  margin: 4px 0;
}

/* Editor section header tweaks */

.admin-editor-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-row-editor-caption {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-danger-zone {
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  background: var(--danger-soft);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.admin-danger-zone-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-danger-zone-head strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--danger-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-danger-zone-head small {
  color: color-mix(in srgb, var(--danger-text) 70%, var(--admin-muted));
  font-size: 12px;
  line-height: 1.45;
}

/* Subsection grouping inside settings sections (per-payment-provider).
   Each subsection is a nested Accordion.Item that defaults to closed —
   users see provider names and expand only the one they want to edit. */

.admin-subsection-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.admin-settings-subsection {
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-surface-2) 40%, transparent);
  overflow: hidden;
}

.admin-settings-subsection-trigger {
  appearance: none;
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  color: var(--admin-text);
  font: inherit;
  cursor: pointer;
  outline: none;
  transition: background 0.12s ease;
}

.admin-settings-subsection-trigger:hover {
  background: var(--admin-surface);
}

.admin-settings-subsection-trigger[data-state="open"] {
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
}

.admin-settings-subsection-trigger:focus-visible {
  background: var(--admin-surface);
  box-shadow: inset 0 0 0 2px var(--admin-ring);
}

.admin-settings-subsection-trigger strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--admin-text);
  letter-spacing: 0;
  min-width: 0;
}

.admin-settings-subsection-meta {
  color: var(--admin-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-settings-subsection-trigger .admin-accordion-chev {
  color: var(--admin-muted);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

.admin-settings-subsection-trigger[data-state="open"] .admin-accordion-chev {
  transform: rotate(90deg);
}

.admin-settings-subsection-body .admin-setting:last-child {
  border-bottom: 0;
}

@media (max-width: 720px) {
  .admin-settings-subsection-trigger {
    padding: 9px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title chev"
      "meta meta";
    row-gap: 4px;
  }

  .admin-settings-subsection-trigger strong {
    grid-area: title;
  }

  .admin-settings-subsection-trigger .admin-accordion-chev {
    grid-area: chev;
  }

  .admin-settings-subsection-meta {
    grid-area: meta;
    white-space: normal;
  }
}
.support-admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(520px, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: stretch;
  min-height: min(820px, calc(100dvh - var(--admin-header-h) - 120px));
}

.support-admin-inbox,
.support-admin-detail,
.support-user-context {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.support-admin-inbox,
.support-admin-detail {
  min-height: 0;
  align-self: stretch;
}

.support-admin-inbox {
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--admin-surface) 88%, var(--admin-bg));
  padding: 14px;
}

.support-admin-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.support-admin-inbox .support-admin-toolbar {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.support-admin-search {
  position: relative;
  display: block;
  min-width: 0;
}

.support-admin-search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--admin-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.support-admin-search .input {
  width: 100%;
  padding-left: 36px;
}

.support-admin-filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.support-admin-filter-row > :last-child {
  grid-column: 1 / -1;
}

.support-inbox-list {
  min-height: 0;
  overflow: hidden;
}

.support-inbox-list-inner {
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.support-inbox-row {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-surface) 72%, var(--admin-bg));
  color: inherit;
  padding: 12px 12px 12px 14px;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.support-inbox-row::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 5px;
  width: 3px;
  border-radius: 3px;
  background: var(--admin-border-strong);
  transition: background 0.16s ease;
}

.support-inbox-row[data-status="open"]::before,
.support-inbox-row[data-status="awaiting_admin"]::before {
  background: var(--accent);
}

.support-inbox-row[data-status="awaiting_user"]::before {
  background: var(--info);
}

.support-inbox-row[data-status="resolved"]::before,
.support-inbox-row[data-status="closed"]::before {
  background: color-mix(in srgb, var(--muted) 70%, transparent);
}

.support-inbox-row[data-priority="urgent"]::before {
  background: var(--danger);
}

.support-inbox-row:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--admin-border));
  background: color-mix(in srgb, var(--admin-surface) 78%, var(--accent) 6%);
}

.support-inbox-row.active {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--admin-border));
  background: color-mix(in srgb, var(--admin-surface) 82%, var(--accent) 10%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.support-inbox-row-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--admin-surface-2) 80%, transparent);
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.support-inbox-row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.support-inbox-row-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.support-inbox-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.support-inbox-row-title svg {
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--accent) 72%, var(--admin-muted));
}

.support-inbox-row-title strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--admin-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-inbox-row-main > small {
  display: block;
  margin: 0;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-row-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.support-row-badges small {
  margin: 0;
  color: var(--admin-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.support-row-badges b {
  display: inline-grid;
  box-sizing: border-box;
  --numeric-badge-optical-y: 0.5px;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0 7px;
  text-align: center;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum";
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}

.support-ticket-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 16px;
  align-items: start;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--admin-surface) 88%, var(--admin-bg));
  padding: 16px;
}

.support-ticket-title {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.support-ticket-title small,
.support-ticket-controls label > span {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-ticket-title h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--admin-text);
}

.support-ticket-title-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.support-ticket-close {
  justify-self: end;
  align-self: start;
  white-space: nowrap;
}

.support-ticket-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-border);
}

.support-ticket-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.support-admin-message-scroll {
  border-color: var(--admin-border);
  background: color-mix(in srgb, var(--admin-bg) 70%, transparent);
}

.support-admin-messages .ticket-message-content {
  max-width: min(78%, 760px);
}

.support-admin-messages .ticket-message-bubble {
  --ticket-bubble-border: var(--admin-border);
  border-color: var(--admin-border);
}

.support-admin-composer {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: var(--admin-surface);
  padding: 14px;
  transition: border-color 0.16s ease;
}

.support-admin-composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--admin-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.support-admin-composer-textarea {
  min-height: 118px;
  resize: vertical;
}

.support-admin-composer-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.support-admin-note-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--admin-surface-2) 78%, transparent);
}

.support-admin-note-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.support-admin-note-toggle label svg {
  color: var(--warning);
}

.support-user-context {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--admin-surface) 88%, var(--admin-bg));
  padding: 16px;
}

.support-user-context > h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--admin-muted);
  text-transform: uppercase;
}

.support-user-context-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.support-user-context-avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--admin-surface-2) 80%, transparent);
  color: var(--admin-text);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.support-user-context-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.support-user-context-identity {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.support-user-context-identity strong {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--admin-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-user-context-identity small {
  color: var(--admin-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.support-user-context-actions {
  display: grid;
  gap: 8px;
}

.support-user-context dl {
  display: grid;
  grid-template-columns: minmax(80px, auto) 1fr;
  gap: 8px 12px;
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--admin-border);
  border-bottom: 1px solid var(--admin-border);
}

.support-user-context dt {
  margin: 0;
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  align-self: center;
}

.support-user-context dd {
  margin: 0;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
  align-self: center;
}

.support-user-context .admin-btn {
  width: 100%;
  justify-content: center;
}

@media (min-width: 981px) {
  .support-admin-layout {
    height: clamp(620px, calc(100dvh - var(--admin-header-h) - 120px), 820px);
  }

  .support-admin-detail {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0;
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--admin-surface) 92%, var(--admin-bg));
    padding: 16px;
  }

  .support-admin-detail > .admin-empty-state {
    min-height: 420px;
    align-self: stretch;
  }

  .support-admin-detail .support-ticket-header {
    border: 0;
    border-bottom: 1px solid var(--admin-border);
    border-radius: 0;
    background: transparent;
    padding: 0 0 14px;
  }

  .support-admin-detail .support-admin-message-scroll {
    height: 100%;
    min-height: 0;
    max-height: none !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 16px 4px;
  }

  .support-admin-detail .support-admin-composer {
    margin-top: 0;
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--admin-border);
    background: transparent;
    padding: 14px 0 0;
  }

  .support-admin-detail .support-admin-composer:focus-within {
    border-color: transparent;
    box-shadow: none;
  }

  .support-user-context {
    position: sticky;
    top: 0;
    align-self: start;
  }
}

@media (max-width: 1420px) {
  .support-admin-layout {
    grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
  }

  .support-user-context {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 980px) {
  .support-admin-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    height: auto;
    min-height: 0;
  }

  .support-admin-inbox {
    border-radius: 12px;
    padding: 12px;
  }

  .support-admin-filter-row,
  .support-ticket-controls {
    grid-template-columns: 1fr;
  }

  .support-ticket-header {
    grid-template-columns: 1fr;
    padding: 14px;
    border-radius: 12px;
  }

  .support-admin-composer,
  .support-user-context {
    border-radius: 12px;
    padding: 14px;
  }

  .support-inbox-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px 11px 11px 13px;
  }

  .support-inbox-row-avatar {
    width: 32px;
    height: 32px;
  }

  .support-row-badges {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .support-ticket-title h3 {
    font-size: 17px;
  }

  .support-ticket-controls {
    padding-top: 10px;
  }

  .support-admin-messages .ticket-message-content {
    max-width: min(86%, calc(100vw - 80px));
  }

  .support-admin-composer-row {
    align-items: stretch;
    flex-direction: column;
  }

  .support-admin-composer-row .admin-btn {
    width: 100%;
  }
}

/* Support tickets: structured inbox + conversation workspace. */

.support-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  width: 100%;
}

.support-admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.support-admin-summary span {
  display: grid;
  min-width: 0;
  gap: 2px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-surface) 86%, var(--admin-bg));
  padding: 12px 14px;
  box-shadow: var(--admin-card-shadow);
}

.support-admin-summary strong {
  color: var(--admin-text);
  font-size: 24px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.support-admin-summary small {
  min-width: 0;
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-admin-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.support-admin-inbox,
.support-admin-detail,
.support-admin-detail .support-ticket-header,
.support-admin-detail .support-admin-composer,
.support-user-context {
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-surface) 88%, var(--admin-bg));
  box-shadow: var(--admin-card-shadow);
}

.support-admin-inbox {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 14px;
}

.support-admin-inbox .support-admin-toolbar {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

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

.support-admin-filter-row > :last-child {
  grid-column: 1 / -1;
}

.support-inbox-list {
  min-height: 0;
  overflow: hidden;
}

.support-inbox-list-inner {
  align-content: start;
  padding-right: 2px;
}

.support-inbox-row {
  min-height: 82px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-surface) 74%, var(--admin-bg));
}

.support-inbox-row-title strong {
  letter-spacing: 0;
}

.support-row-badges {
  min-width: 86px;
  max-width: 132px;
}

.support-row-badges .admin-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-admin-detail {
  display: grid;
  grid-template-rows: auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 14px;
}

.support-admin-detail > .admin-empty-state {
  min-height: 360px;
  align-self: stretch;
}

.support-admin-detail .support-ticket-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
}

.support-ticket-actions {
  display: flex;
  justify-content: flex-end;
}

.support-ticket-close {
  white-space: nowrap;
}

.support-ticket-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-border);
}

.support-ticket-controls label {
  display: grid;
  flex: 1 1 150px;
  gap: 6px;
  min-width: 0;
}

.support-admin-detail .support-admin-message-scroll {
  min-height: 240px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-bg) 68%, transparent);
  padding: 16px;
}

.support-admin-detail .support-admin-composer {
  display: grid;
  gap: 10px;
  margin-top: 0;
  padding: 14px;
}

.support-admin-detail .support-admin-composer-textarea {
  min-height: 86px;
}

.support-admin-detail .support-admin-composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--admin-border));
  box-shadow:
    var(--admin-card-shadow),
    0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.support-user-context {
  display: grid;
  grid-column: auto;
  gap: 12px;
  position: static;
  min-width: 0;
  padding: 12px;
}

.support-user-context-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.support-user-context-avatar {
  width: 44px;
  height: 44px;
}

.support-user-context-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.support-user-context-identity small {
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.support-user-context-identity strong,
.support-user-context-identity span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-user-context-identity strong {
  color: var(--admin-text);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.15;
}

.support-user-context-identity span {
  color: var(--admin-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.support-user-context-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  min-width: 0;
}

.support-user-context-metrics span {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--admin-border) 82%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-surface-2) 68%, var(--admin-bg));
  padding: 9px 10px;
}

.support-user-context-metrics small {
  color: var(--admin-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
}

.support-user-context-metrics strong {
  min-width: 0;
  overflow: hidden;
  color: var(--admin-text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-user-context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.support-user-context-actions .admin-btn {
  width: auto;
  justify-content: center;
}

@media (min-width: 981px) {
  .support-admin-workspace {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    height: clamp(660px, calc(100dvh - var(--admin-header-h) - 112px), 840px);
  }

  .support-admin-inbox,
  .support-admin-detail {
    height: 100%;
  }

  .support-admin-detail {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .support-admin-detail .support-admin-message-scroll {
    height: 100%;
    min-height: 0;
    max-height: none !important;
    overflow: hidden;
  }
}

@media (min-width: 1360px) {
  .support-user-context {
    grid-template-columns: minmax(170px, 0.65fr) minmax(260px, 1.35fr) auto;
    align-items: center;
  }

  .support-user-context-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .support-admin-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .support-admin-detail .support-ticket-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .support-ticket-actions {
    justify-content: stretch;
  }

  .support-ticket-actions .admin-btn,
  .support-user-context-actions .admin-btn {
    width: 100%;
  }

  .support-ticket-controls,
  .support-admin-composer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .support-ticket-controls label {
    flex-basis: auto;
  }

  .support-inbox-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .support-row-badges {
    grid-column: 2;
    max-width: none;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }
}

/* Support tickets v2: one-column admin list with modal ticket details. */

.support-admin-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 14px;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.support-admin-summary span {
  min-height: 66px;
}

.support-admin-list-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-surface) 88%, var(--admin-bg));
  box-shadow: var(--admin-card-shadow);
  padding: 14px;
}

.support-admin-ticket-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-bg) 78%, var(--admin-surface));
  padding: 4px;
}

.support-admin-ticket-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--admin-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.support-admin-ticket-tabs button.active {
  background: var(--admin-surface);
  color: var(--admin-text);
  box-shadow: var(--admin-card-shadow);
}

.support-admin-ticket-tabs button b {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--admin-surface-2) 76%, transparent);
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 850;
  padding-inline: 7px;
}

.support-admin-ticket-tabs button.active b {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: color-mix(in srgb, var(--accent) 78%, white);
}

.support-admin-list-panel .support-admin-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.35fr);
  gap: 10px;
  align-items: start;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.support-admin-list-panel .support-admin-search .input {
  box-sizing: border-box;
  height: 36px;
  padding-left: 42px;
}

.support-admin-list-panel .support-admin-filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.support-admin-list-panel .support-admin-filter-row .admin-select-trigger,
.support-admin-list-panel .support-admin-filter-row .admin-btn {
  height: 46px;
  min-height: 46px;
}

.support-admin-list-panel .support-admin-filter-row > :last-child {
  grid-column: auto;
}

.support-admin-list-panel .support-inbox-list {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

.support-admin-list-panel .support-inbox-list-inner {
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 4px;
}

.support-admin-list-panel > .admin-empty-state {
  align-self: stretch;
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px dashed color-mix(in srgb, var(--admin-border) 84%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-bg) 66%, transparent);
}

.support-admin-list-panel .support-inbox-row {
  min-height: 74px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-surface) 74%, var(--admin-bg));
}

.support-admin-list-panel .support-inbox-row[data-priority="high"]::before {
  background: var(--warning);
}

.support-admin-list-panel .support-inbox-row[data-priority="urgent"]::before {
  background: var(--danger);
}

.support-admin-list-panel .support-inbox-row-avatar {
  width: 38px;
  height: 38px;
}

.support-admin-list-panel .support-row-badges {
  min-width: 168px;
  max-width: 240px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.support-admin-list-panel .support-row-badges small {
  flex-basis: 100%;
  text-align: right;
}

.support-ticket-list-skeleton {
  display: grid;
  gap: 8px;
}

.support-ticket-row-skeleton {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 12px;
  min-height: 74px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--admin-surface) 74%, var(--admin-bg));
  padding: 12px 14px;
}

.support-ticket-row-skeleton-main,
.support-ticket-row-skeleton-side {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.support-ticket-row-skeleton-side {
  justify-items: end;
}

.support-ticket-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1040px, calc(100vw - 28px));
  max-height: min(840px, calc(100dvh - 28px));
  overflow: hidden;
}

.support-ticket-dialog-body {
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.support-ticket-dialog .support-ticket-header,
.support-ticket-dialog .support-user-context,
.support-ticket-dialog .support-admin-composer {
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-surface) 88%, var(--admin-bg));
  box-shadow: none;
}

.support-ticket-dialog .support-ticket-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
}

.support-ticket-dialog .support-user-context {
  padding: 12px;
}

.support-ticket-dialog .support-admin-message-scroll {
  min-height: 0;
  height: 100%;
  max-height: none !important;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--admin-bg) 68%, transparent);
  padding: 16px;
}

.support-ticket-dialog .support-admin-composer {
  margin: 0;
  padding: 12px;
}

.support-ticket-dialog .support-admin-composer-textarea {
  min-height: 76px;
}

.support-ticket-dialog-skeleton {
  display: grid;
  gap: 12px;
  min-width: 0;
}

@media (max-width: 1120px) {
  .support-admin-list-panel .support-admin-toolbar,
  .support-admin-list-panel .support-admin-filter-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .support-admin-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .support-admin-summary span {
    min-height: 56px;
    border-radius: 10px;
    padding: 9px 8px;
  }

  .support-admin-summary strong {
    font-size: 20px;
  }

  .support-admin-summary small {
    font-size: 10px;
  }

  .support-admin-list-panel {
    padding: 12px;
  }

  .support-admin-list-panel .support-inbox-row,
  .support-ticket-row-skeleton {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }

  .support-admin-list-panel .support-row-badges,
  .support-ticket-row-skeleton-side {
    grid-column: 2;
    min-width: 0;
    max-width: none;
    justify-content: flex-start;
    justify-items: start;
  }

  .support-admin-list-panel .support-row-badges small {
    flex-basis: auto;
    text-align: left;
  }

  .support-ticket-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
    overflow-y: auto;
  }

  .support-ticket-dialog-body {
    grid-template-rows: auto auto auto auto;
    gap: 10px;
    overflow: visible;
  }

  .support-ticket-dialog .support-ticket-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .support-ticket-dialog .support-ticket-actions {
    justify-content: stretch;
  }

  .support-ticket-dialog .support-ticket-actions .admin-btn {
    width: 100%;
  }

  .support-ticket-dialog .support-admin-message-scroll {
    height: auto;
    min-height: 180px;
    max-height: min(32dvh, 260px) !important;
    padding: 12px 10px;
  }

  .support-ticket-dialog .support-admin-composer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .support-ticket-dialog .support-admin-composer-row .admin-btn {
    width: 100%;
  }
}

/* Support ticket dialog v3: one readable page, compact metadata, no nested chat scroll. */

.dialog:has(.support-ticket-dialog) {
  align-items: start;
  overflow-y: auto;
}

.support-ticket-dialog {
  display: grid;
  grid-template-rows: auto;
  gap: 10px;
  width: min(940px, calc(100vw - 24px));
  max-height: none;
  margin-block: 0;
  overflow: visible;
  padding: 14px;
  border-radius: 16px;
}

.support-ticket-dialog .dialog-head {
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--admin-border);
}

.support-ticket-dialog .dialog-head h2 {
  overflow: hidden;
  font-size: 18px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-ticket-dialog .dialog-head p {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.25;
}

.support-ticket-dialog-body {
  display: grid;
  grid-template-rows: auto;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.support-ticket-dialog .support-ticket-header,
.support-ticket-dialog .support-user-context,
.support-ticket-dialog .support-admin-composer {
  border-radius: 10px;
  box-shadow: none;
}

.support-ticket-dialog .support-ticket-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.support-ticket-statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.support-ticket-statusbar .admin-badge {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-ticket-dialog .support-ticket-actions {
  display: flex;
  justify-content: flex-end;
}

.support-ticket-dialog .support-ticket-close {
  min-height: 34px;
  white-space: nowrap;
}

.support-ticket-dialog .support-ticket-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--admin-border);
}

.support-ticket-dialog .support-ticket-controls .admin-select-trigger {
  height: 34px;
  min-width: 0;
  padding-inline: 10px;
}

.support-ticket-dialog .support-ticket-controls .admin-select-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-ticket-dialog .support-user-context {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.support-ticket-dialog .support-user-context-head {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
}

.support-ticket-dialog .support-user-context-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.support-ticket-dialog .support-user-context-identity {
  gap: 2px;
}

.support-ticket-dialog .support-user-context-identity strong {
  font-size: 13px;
}

.support-ticket-dialog .support-user-context-identity small {
  overflow: hidden;
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.support-ticket-dialog .support-user-context-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.support-ticket-dialog .support-user-context-metrics span {
  gap: 2px;
  min-height: 44px;
  border-radius: 8px;
  padding: 6px 8px;
}

.support-ticket-dialog .support-user-context-metrics small {
  font-size: 9px;
  line-height: 1;
}

.support-ticket-dialog .support-user-context-metrics strong {
  font-size: 11px;
  line-height: 1.2;
}

.support-ticket-dialog .support-user-context-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.support-ticket-dialog .support-user-context-actions .admin-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 7px;
  padding: 0;
  white-space: nowrap;
}

.support-ticket-dialog .support-admin-message-scroll {
  height: auto;
  min-height: 0;
  max-height: none !important;
  overflow: visible;
  border-radius: 10px;
  padding: 12px;
}

.support-ticket-dialog .support-admin-messages {
  gap: 12px;
}

.support-ticket-dialog .support-admin-composer {
  margin: 0;
  padding: 10px;
}

.support-ticket-dialog .support-admin-composer-textarea {
  min-height: 74px;
}

.support-ticket-dialog .support-admin-composer-row {
  gap: 8px;
}

@media (min-width: 721px) {
  .dialog:has(.support-ticket-dialog) {
    align-items: start;
  }

  .support-ticket-dialog {
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - 28px);
    min-height: calc(100dvh - 28px);
    max-height: calc(100dvh - 28px);
    overflow: hidden;
  }

  .support-ticket-dialog-body {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
    overflow: hidden;
  }

  .support-ticket-dialog .support-admin-message-scroll {
    height: 100%;
    min-height: 320px;
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .dialog:has(.support-ticket-dialog) {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .support-ticket-dialog {
    width: calc(100vw - 16px);
    max-height: none;
    padding: 12px;
    border-radius: 14px;
    overflow: visible;
  }

  .support-ticket-dialog .dialog-head {
    padding-bottom: 8px;
  }

  .support-ticket-dialog .dialog-head h2 {
    font-size: 16px;
  }

  .support-ticket-dialog .support-ticket-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
  }

  .support-ticket-dialog .support-ticket-actions {
    justify-content: flex-start;
  }

  .support-ticket-dialog .support-ticket-actions .admin-btn {
    width: auto;
  }

  .support-ticket-dialog .support-ticket-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .support-ticket-dialog .support-ticket-controls .admin-select-trigger {
    height: 32px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .support-ticket-dialog .support-user-context {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
  }

  .support-ticket-dialog .support-user-context-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .support-ticket-dialog .support-user-context-actions {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-content: flex-start;
  }

  .support-ticket-dialog .support-admin-message-scroll {
    height: auto;
    min-height: 0;
    max-height: none !important;
    padding: 10px 8px;
  }

  .support-ticket-dialog .support-admin-composer-row {
    flex-direction: row;
    align-items: center;
  }

  .support-ticket-dialog .support-admin-composer-row .admin-btn {
    width: auto;
  }
}
