/* Source role: Admin console styling for styles. */
:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #d9e2ec;
  --line-soft: #edf2f7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #e6f4f1;
  --accent-ring: rgba(15, 118, 110, 0.18);
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --warn: #b7791f;
  --warn-soft: #fff8e6;
  --ok: #16794c;
  --ok-soft: #ecfdf3;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 12px 32px rgba(15, 23, 42, 0.09);
  --radius-panel: 8px;
  --radius-control: 6px;
  --radius-badge: 4px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --type-display-size: 30px;
  --type-page-title-size: 20px;
  --type-section-title-size: 16px;
  --type-component-title-size: 14px;
  --type-body-size: 13px;
  --type-button-size: 12px;
  --type-meta-size: 11px;
  --type-regular-weight: 400;
  --type-medium-weight: 500;
  --type-semibold-weight: 600;
}

/* Reference navigation: dark workspace rail with cyan section hierarchy. */
.app-shell {
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 16px 18px;
  background: #0e1828;
  color: #d7deea;
  scrollbar-width: auto;
  scrollbar-color: #35465c transparent;
}

.sidebar::-webkit-scrollbar {
  width: 16px;
}

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

.sidebar::-webkit-scrollbar-thumb {
  min-height: 120px;
  border: 4px solid transparent;
  border-radius: 999px;
  background: #35465c;
  background-clip: padding-box;
}

.brand {
  margin: 0 0 14px;
  padding: 4px 10px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.brand strong {
  color: #eef5ff;
  font-size: 17px;
  letter-spacing: 0;
}

.brand span {
  color: #75d8ff;
  font-size: 12px;
}

.nav {
  gap: 4px;
}

.nav-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin: 24px 10px 8px;
  color: #66d5ff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.nav-divider:first-child {
  margin-top: 4px;
}

.nav-divider::after {
  content: "⌄";
  flex: 0 0 auto;
  width: 20px;
  height: 24px;
  color: #6edbff;
  font-size: 24px;
  font-weight: 400;
  line-height: 17px;
  text-align: center;
  background: transparent;
}

.nav button,
.ghost {
  min-height: 52px;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: 12px;
  color: #cdd5e2;
  padding: 0 12px 0 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

.nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.nav button:hover {
  background: rgba(108, 128, 154, 0.14);
  color: #f7fbff;
}

.nav button.active {
  border-left-color: #1cc7b5;
  background: #202c3b;
  color: #f8fbff;
  box-shadow: none;
}

.nav-icon {
  display: inline-grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #d3dbe7;
}

.nav-icon svg {
  display: block;
  width: 25px;
  height: 25px;
}

.nav button:hover .nav-icon,
.nav button.active .nav-icon {
  color: #f7fbff;
}

.nav-parent {
  justify-content: flex-start;
  color: #6edbff;
}

.nav-parent > span:first-of-type {
  flex: 1;
  color: inherit;
}

.nav-parent .nav-caret {
  flex: 0 0 auto;
  color: #6edbff;
  font-size: 22px;
  line-height: 1;
}

.nav-parent.open .nav-caret {
  transform: rotate(90deg);
}

.nav-parent.active,
.nav-parent.open {
  border-left-color: transparent;
  background: transparent;
  color: #6edbff;
  box-shadow: none;
}

.nav-submenu {
  display: grid;
  gap: 4px;
  margin: 0 0 6px 14px;
  padding: 2px 0 2px 10px;
  border-left: 1px solid rgba(110, 219, 255, 0.18);
}

.nav-child {
  min-height: 44px;
  font-size: 15px;
}

.ghost {
  min-height: 44px;
  margin-top: 18px;
  border-color: rgba(148, 163, 184, 0.20);
  background: rgba(15, 23, 42, 0.28);
  color: #bfc9d8;
  text-align: center;
}

.ghost:hover {
  background: rgba(108, 128, 154, 0.16);
  color: #fff;
}

@media (max-width: 1100px) {
  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    min-height: auto;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .sidebar {
    padding: 14px;
  }

  .nav-divider {
    display: none;
  }

  .nav button,
  .ghost {
    min-height: 44px;
    font-size: 14px;
  }

  .nav-icon {
    flex-basis: 22px;
    width: 22px;
    height: 22px;
  }

  .nav-icon svg {
    width: 21px;
    height: 21px;
  }

  .nav button.active {
    box-shadow: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(238, 242, 247, 0.96)),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", Arial, sans-serif;
  font-size: var(--type-body-size);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

::selection {
  background: rgba(15, 118, 110, 0.18);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(960px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 48px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.login-panel h1 {
  margin: 8px 0 14px;
  font-size: var(--type-display-size);
  line-height: 1.15;
}

.auth-card {
  width: 100%;
  display: grid;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
  line-height: 1.8;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.auth-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-weight: var(--type-semibold-weight);
  white-space: nowrap;
}

.auth-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 128px;
  gap: 10px;
  align-items: end;
}

.inline-fields button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: var(--type-semibold-weight);
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: var(--type-component-title-size);
  font-weight: var(--type-semibold-weight);
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.primary,
.toolbar button,
.compact button {
  min-height: 40px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: var(--type-semibold-weight);
}

.primary:hover,
.toolbar button:hover,
.compact button:hover {
  background: var(--accent-dark);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: var(--type-component-title-size);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #e5e7eb;
  padding: 22px 16px;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 6px 8px 22px;
}

.brand strong {
  font-size: var(--type-section-title-size);
}

.brand span {
  color: #9ca3af;
  font-size: var(--type-body-size);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button,
.ghost {
  width: 100%;
  min-height: 42px;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 0 12px;
}

.nav-section {
  display: grid;
  gap: 6px;
}

.nav-parent {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-caret {
  color: #94a3b8;
  font-size: var(--type-button-size);
  transition: transform 0.16s ease;
}

.nav-parent.open .nav-caret {
  transform: rotate(90deg);
}

.nav-submenu {
  display: grid;
  gap: 4px;
  padding-left: 12px;
}

.nav-submenu.hidden {
  display: none;
}

.nav-child {
  min-height: 36px;
  font-size: var(--type-body-size);
}

.nav button.active,
.nav button:hover {
  background: #1f2937;
  color: #fff;
}

.ghost {
  margin-top: auto;
  border: 1px solid #374151;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 6px 0 0;
  font-size: var(--type-page-title-size);
}

.admin-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
}

.admin-meta span {
  color: var(--text);
  font-weight: var(--type-semibold-weight);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 14px;
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics article {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 18px;
}

.metrics span {
  color: var(--muted);
  font-size: var(--type-body-size);
}

.metrics strong {
  font-size: var(--type-display-size);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 96px;
  gap: 10px;
  margin-bottom: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 112px 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.config-version {
  align-self: center;
  color: var(--muted);
  font-size: var(--type-body-size);
}

.toolbar.compact {
  grid-template-columns: 180px 180px 96px;
}

.toolbar.admin-member-toolbar {
  grid-template-columns: 96px 150px 1fr;
}

.toolbar.billing-toolbar {
  grid-template-columns: 180px 180px 96px 120px;
}

.toolbar.coupon-toolbar,
.toolbar.banner-toolbar {
  grid-template-columns: 180px 96px 132px;
}

.toolbar.agent-level-toolbar {
  grid-template-columns: 180px 96px 144px;
}

.toolbar.ai-model-toolbar {
  grid-template-columns: 180px 180px 96px 120px;
}

.toolbar.ai-config-toolbar {
  grid-template-columns: 1fr 150px;
}

.toolbar.ai-log-toolbar {
  grid-template-columns: 150px minmax(180px, 1fr) 160px 150px 96px 96px;
}

.toolbar.log-toolbar {
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 0.8fr) 160px 96px;
}

.toolbar.finance-toolbar {
  grid-template-columns: 150px 150px 150px 170px minmax(220px, 1fr) 96px;
}

.toolbar.system-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.toolbar.system-tabs button {
  flex: 0 0 120px;
}

.toolbar.system-tabs #loadSystemSettingsButton {
  flex-basis: 96px;
  margin-left: auto;
}

.toolbar.enterprise-tabs {
  margin-bottom: 16px;
}

.toolbar.enterprise-list-toolbar {
  grid-template-columns: minmax(220px, 1fr) 160px 160px 96px;
}

.toolbar.enterprise-audit-toolbar {
  grid-template-columns: 180px 96px;
}

.toolbar.finance-tabs,
.toolbar.ai-prompt-tabs {
  grid-template-columns: repeat(3, 120px);
  justify-content: start;
}

.toolbar.ai-skill-tabs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: thin;
}

.toolbar.ai-skill-tabs button {
  flex: 0 0 auto;
  min-width: 120px;
  white-space: nowrap;
}

.toolbar.system-tabs button.active,
.toolbar.finance-tabs button.active,
.toolbar.ai-prompt-tabs button.active,
.toolbar.ai-skill-tabs button.active,
.toolbar.enterprise-detail-tabs button.active {
  background: var(--sidebar);
  color: #fff;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.canvas-monitor-tabs {
  display: grid;
  grid-template-columns: repeat(3, 160px);
  justify-content: start;
}

.canvas-monitor-tabs button {
  width: 160px;
  justify-content: center;
}

.canvas-monitor-table-wrap {
  cursor: grab;
  overscroll-behavior-x: contain;
  touch-action: pan-y;
  user-select: none;
}

.canvas-monitor-table-wrap.is-dragging {
  cursor: grabbing;
}

.canvas-monitor-table-wrap table {
  min-width: 1280px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  height: 48px;
  border-bottom: 1px solid #eef2f6;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: var(--type-component-title-size);
}

th {
  color: #475569;
  background: #f8fafc;
  font-weight: var(--type-semibold-weight);
}

td {
  color: #263445;
}

.task-id-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tiny-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  padding: 0 10px;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
  white-space: nowrap;
}

.tiny-button:hover {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
  background: #e2e8f0;
  color: #334155;
}

.badge.ACTIVE,
.badge.PUBLISHED,
.badge.SUCCESS,
.badge.UNUSED {
  background: #dcfce7;
  color: var(--ok);
}

.badge.DISABLED,
.badge.LOCKED,
.badge.DELETED,
.badge.FAILED,
.badge.CLOSED {
  background: #fee2e2;
  color: var(--danger);
}

.badge.DRAFT,
.badge.ARCHIVED,
.badge.CREATED,
.badge.USED {
  background: #fef3c7;
  color: var(--warn);
}

.badge.REFUNDED {
  background: #ede9fe;
  color: #6d28d9;
}

.badge.identity.NORMAL {
  background: #e2e8f0;
  color: #334155;
}

.badge.identity.VIP {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.identity.ADVANCED_VIP {
  background: #f3e8ff;
  color: #7e22ce;
}

.badge.identity.SVIP {
  background: #fce7f3;
  color: #be185d;
}

.badge.membership.MONTHLY {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.membership.QUARTERLY {
  background: #f3e8ff;
  color: #7e22ce;
}

.badge.membership.YEARLY {
  background: #fce7f3;
  color: #be185d;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-row-actions {
  flex-wrap: nowrap;
  min-width: max-content;
}

.row-actions button {
  min-height: 32px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 10px;
}

.row-actions button:hover {
  background: #dfe7f0;
}

.row-actions button.danger-button {
  background: #fee2e2;
  color: var(--danger);
}

.row-actions button.danger-button:hover {
  background: #fecaca;
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
}

.system-settings-panel {
  display: grid;
  gap: 16px;
}

.system-settings-form {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  align-items: end;
}

.system-settings-form h3,
.system-settings-form .row-actions,
.system-settings-form .inline-fields,
.system-settings-form .wide-field {
  grid-column: 1 / -1;
}

.system-settings-form .inline-fields {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.system-platform-form {
  display: block;
  padding: 0;
  overflow: hidden;
}

.system-platform-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.system-platform-heading h2,
.system-config-section-heading h3 {
  margin: 0;
  color: var(--text);
}

.system-platform-heading h2 {
  font-size: var(--type-page-title-size);
}

.system-platform-heading p,
.system-config-section-heading p {
  margin: 5px 0 0;
}

.system-config-section {
  display: grid;
  gap: 16px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.system-config-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.system-config-section-heading h3 {
  font-size: var(--type-section-title-size);
}

.system-config-section-heading .muted {
  line-height: 1.5;
  text-align: right;
}

.system-config-grid {
  display: grid;
  gap: 14px;
  align-items: end;
}

.system-config-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.system-config-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.system-config-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.system-config-wide {
  grid-column: 1 / -1;
}

.platform-brand-assets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.platform-brand-asset {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: #fff;
}

.platform-brand-preview {
  display: grid;
  height: 92px;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  background: #eef2f7;
  color: var(--muted);
  font-size: var(--type-button-size);
}

.platform-brand-asset-dark .platform-brand-preview {
  background: #18212f;
  color: #aeb9c8;
}

.platform-brand-asset-light .platform-brand-preview {
  background: #fff;
}

.platform-brand-preview img {
  display: block;
  width: auto;
  max-width: calc(100% - 28px);
  height: auto;
  max-height: 58px;
  object-fit: contain;
}

.platform-brand-preview-square img {
  max-width: 52px;
  max-height: 52px;
}

.platform-brand-file-input {
  display: none;
}

.platform-brand-asset-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.platform-brand-asset-meta > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.platform-brand-asset-meta strong {
  color: var(--text);
  font-size: var(--type-component-title-size);
}

.platform-brand-asset-meta small {
  min-height: 0;
}

.platform-brand-asset-meta button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #eef3f8;
  color: #263445;
  padding: 0 11px;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
}

.platform-brand-asset-meta button:hover {
  border-color: #bdcad8;
  background: #e3eaf2;
}

.platform-brand-asset-meta button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.system-upload-policy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.system-upload-policy-item {
  display: grid;
  min-width: 0;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel-soft);
  padding: 14px;
}

.system-upload-policy-item > strong {
  color: var(--text);
  font-size: var(--type-component-title-size);
}

.system-auth-switches {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.system-auth-switches .checkbox-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  padding: 0 12px;
}

.row-actions.system-platform-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  width: 100%;
  box-sizing: border-box;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.system-platform-actions button {
  min-width: 168px;
}

.checkbox-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: var(--type-semibold-weight);
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.system-settings-form small,
.system-sms-forms small {
  min-height: 18px;
  color: var(--muted);
  font-size: var(--type-button-size);
  font-weight: var(--type-medium-weight);
}

.video-processing-tool-cost-form {
  grid-column: 1 / -1;
}

.video-processing-tool-cost-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.video-processing-tool-cost-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel-soft);
  padding: 14px;
}

.video-processing-tool-cost-group h4 {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: var(--type-component-title-size);
}

.video-processing-tool-cost-list {
  display: grid;
  gap: 10px;
}

.video-processing-tool-cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: #fff;
  padding: 10px;
}

.video-processing-tool-cost-row span {
  min-width: 0;
}

.video-processing-tool-cost-row strong,
.video-processing-tool-cost-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-processing-tool-cost-row input {
  min-height: 36px;
}

.system-sms-forms {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}

.system-sms-forms .inline-fields {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.billing-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.billing-form {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: end;
}

.billing-form h3,
.billing-form .row-actions {
  grid-column: 1 / -1;
}

.activity-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.activity-form {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: end;
}

.activity-form h3,
.activity-form input[type="hidden"],
.activity-form .row-actions {
  grid-column: 1 / -1;
}

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

.wide-panel {
  min-width: 0;
}

.mini-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mini-form .wide-field {
  grid-column: 1 / -1;
}

.mini-form button {
  min-height: 40px;
}

.mini-form button:not(.primary) {
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 16px;
  font-weight: var(--type-semibold-weight);
}

.mini-form button:not(.primary):hover {
  background: #dfe7f0;
}

.file-control {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: var(--type-component-title-size);
  font-weight: var(--type-semibold-weight);
}

.file-control input[type="file"] {
  padding: 7px 10px;
}

.style-cover-thumb {
  width: 64px;
  height: 42px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.banner-thumb {
  width: 112px;
  height: 48px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.link-cell {
  max-width: 280px;
}

.home-background-video-thumb {
  width: 128px;
  height: 72px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111827;
}

.home-background-video-current {
  display: grid;
  gap: 8px;
}

.home-background-video-current > span {
  color: #334155;
  font-size: var(--type-component-title-size);
  font-weight: var(--type-semibold-weight);
}

.home-background-video-modal-preview {
  width: 100%;
  max-height: 300px;
  border-radius: 8px;
  background: #111827;
}

.link-cell a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  vertical-align: middle;
}

.redeem-toolbar {
  grid-template-columns: minmax(220px, 1fr) 160px 160px 96px 132px;
}

.redeem-result {
  display: grid;
  gap: 6px;
  color: var(--muted);
  line-height: 1.7;
}

.redeem-result strong {
  color: var(--text);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--type-component-title-size);
}

.pagination button {
  min-height: 34px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 12px;
  font-weight: var(--type-semibold-weight);
}

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

.compact-table {
  max-height: 280px;
}

.compact-table table {
  min-width: 520px;
}

.modal-table table,
.model-picker-table table {
  min-width: 760px;
}

.model-picker {
  display: grid;
  gap: 10px;
}

.model-picker-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
}

.model-picker-toolbar button,
.model-picker-table button {
  min-height: 34px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 12px;
  font-weight: var(--type-semibold-weight);
}

.model-picker-table {
  max-height: 260px;
}

.ai-task-table {
  margin-top: 14px;
}

.stage-log-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: #f8fafc;
  padding: 14px;
  margin-top: 12px;
}

.stage-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  padding: 16px;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: var(--type-section-title-size);
}

.panel-heading {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-heading h3 {
  margin: 0;
}

.panel-heading button {
  min-height: 34px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: var(--type-semibold-weight);
}

.export-options-grid,
.export-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 14px;
}

.export-options-grid .checkbox-row,
.export-fields-grid .checkbox-row {
  min-height: 32px;
  font-weight: var(--type-medium-weight);
}

#adminModalRoot {
  position: relative;
  z-index: 80;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.admin-dialog {
  position: fixed;
  inset: 48px 24px auto;
  width: min(880px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  margin: 0 auto;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.admin-dialog.admin-dialog-wide {
  width: min(1180px, calc(100vw - 48px));
}

.modal-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: var(--type-page-title-size);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  font-size: var(--type-page-title-size);
  line-height: 1;
  text-align: center;
}

.modal-body {
  overflow: auto;
  padding: 18px;
}

.modal-form,
.modal-section {
  display: grid;
  gap: 14px;
}

.modal-section + .modal-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #eef2f6;
}

.modal-section h3 {
  margin: 0;
  font-size: var(--type-section-title-size);
}

.modal-section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.modal-section-heading > button {
  min-height: 34px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 12px;
  font-weight: var(--type-semibold-weight);
}

.modal-section-heading > button:hover {
  background: #dfe7f0;
}

.channel-price-list {
  display: grid;
  gap: 10px;
}

.channel-price-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 190px) minmax(140px, 170px);
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.channel-output-spec-row {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  align-items: end;
}

.channel-output-spec-default {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
}

.channel-output-spec-default input {
  width: 16px;
  height: 16px;
}

.channel-price-title {
  display: grid;
  gap: 4px;
}

.channel-price-title strong {
  color: var(--text);
  font-size: var(--type-component-title-size);
}

.channel-price-title span {
  color: var(--muted);
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
}

.channel-model-table {
  max-height: 360px;
}

.channel-model-table table {
  min-width: 980px;
}

.readonly-field input[readonly] {
  background: #f8fafc;
  color: #475569;
  cursor: default;
}

.compact-empty {
  min-height: 96px;
}

.enterprise-detail-shell {
  display: grid;
  gap: 14px;
}

.enterprise-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.enterprise-detail-tabs button {
  flex: 0 0 112px;
}

.enterprise-month-filter {
  min-width: min(340px, 100%);
  grid-template-columns: minmax(160px, 1fr) 96px;
  margin-bottom: 0;
}

.modal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.modal-summary span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #f8fafc;
}

.ai-model-test-shell {
  display: grid;
  gap: 14px;
}

.ai-model-test-chat {
  min-height: 280px;
  max-height: min(52vh, 520px);
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: #f8fafc;
  padding: 14px;
}

.ai-model-test-empty {
  align-self: center;
  justify-self: center;
  color: var(--muted);
  font-weight: var(--type-semibold-weight);
}

.ai-model-test-message {
  display: flex;
  width: 100%;
}

.ai-model-test-message > div {
  max-width: min(76%, 680px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  line-height: 1.7;
  box-shadow: var(--shadow-xs);
  white-space: pre-wrap;
}

.ai-model-test-message.user {
  justify-content: flex-end;
}

.ai-model-test-message.user > div {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--accent);
  color: #fff;
}

.ai-model-test-message.assistant {
  justify-content: flex-start;
}

.ai-model-test-message.error > div,
.ai-model-test-error {
  color: var(--danger);
}

.ai-model-test-message pre {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.ai-model-test-media {
  display: block;
  width: min(100%, 520px);
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-model-test-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--type-button-size);
  word-break: break-all;
}

.ai-model-test-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
}

.ai-model-test-options {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
}

.real-person-config {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: #f8fafc;
  padding: 14px;
}

.real-person-config-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.real-person-config-header p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
}

.segmented-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-buttons button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-weight: var(--type-semibold-weight);
}

.segmented-buttons button.active {
  border-color: var(--accent);
  background: #e6fffb;
  color: var(--accent-strong);
}

.segmented-buttons button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.real-person-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.real-person-config small {
  color: var(--muted);
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
}

.field-hint {
  color: var(--muted);
  font-size: var(--type-button-size);
  font-weight: var(--type-medium-weight);
  line-height: 1.6;
}

.refund-preview-result {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: #f8fafc;
  padding: 14px;
}

.refund-preview-empty {
  min-height: 88px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: var(--type-semibold-weight);
  text-align: center;
}

.refund-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.refund-preview-grid > div {
  display: grid;
  gap: 6px;
  min-height: 72px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: #fff;
  padding: 10px;
}

.refund-preview-grid span {
  color: var(--muted);
  font-size: var(--type-button-size);
}

.refund-preview-grid strong {
  color: var(--text);
  font-size: var(--type-section-title-size);
}

.refund-preview-grid .refund-preview-amount {
  border-color: rgba(180, 35, 24, 0.28);
  background: var(--danger-soft);
}

.refund-preview-grid .refund-preview-amount strong {
  color: var(--danger);
  font-size: var(--type-page-title-size);
}

.refund-preview-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: var(--type-body-size);
  line-height: 1.7;
}

.user-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-detail-actions button {
  min-height: 34px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 12px;
  font-weight: var(--type-semibold-weight);
}

.user-detail-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.user-project-table table {
  min-width: 760px;
}

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

.modal-grid .wide-field {
  grid-column: 1 / -1;
}

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

.admin-permission-picker > span {
  color: var(--muted);
  font-size: var(--type-body-size);
}

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

.admin-permission-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}

.admin-permission-group.single {
  display: flex;
  align-items: center;
}

.admin-permission-children {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-left: 8px;
}

.detail-item {
  display: grid;
  gap: 6px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fafc;
}

.detail-item span {
  color: var(--muted);
  font-size: var(--type-button-size);
}

.detail-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--type-component-title-size);
  font-weight: var(--type-semibold-weight);
}

.detail-code-block {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: var(--type-button-size);
  line-height: 1.65;
}
.ai-task-table th:first-child,
.ai-task-table td:first-child {
  min-width: 150px;
  white-space: nowrap;
}

.ai-result-request {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.ai-result-request summary {
  cursor: pointer;
  padding: 13px 14px;
  color: var(--text);
  font-size: var(--type-component-title-size);
  font-weight: var(--type-semibold-weight);
  user-select: none;
}

.ai-result-request[open] summary {
  border-bottom: 1px solid var(--line);
}

.ai-result-request .detail-code-block,
.ai-result-request .ai-result-empty {
  margin: 14px;
}

.ai-result-output {
  margin-top: 18px;
}

.ai-result-text {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 14px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.ai-result-empty {
  margin: 0;
  color: var(--muted);
}

.ai-result-media-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 14px;
}

.ai-result-media-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f172a;
}

.ai-result-media-item img,
.ai-result-media-item video {
  display: block;
  width: 100%;
  max-height: 60vh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #05070b;
}

.ai-result-media-item audio {
  display: block;
  width: 100%;
  margin: 18px 0;
}

.ai-result-media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 8px 12px;
  background: var(--panel);
}

.ai-result-media-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-result-download {
  flex: 0 0 auto;
  color: var(--primary);
  font-weight: var(--type-semibold-weight);
  text-decoration: none;
}

.ai-result-download:hover {
  text-decoration: underline;
}


.copy-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fafc;
}

.copy-item span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: var(--type-button-size);
}

.copy-item strong {
  min-width: 0;
  align-self: center;
  overflow-wrap: anywhere;
  font-size: var(--type-component-title-size);
}

.copy-item button {
  min-height: 32px;
  align-self: center;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 12px;
  font-weight: var(--type-semibold-weight);
}

.copy-item button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 0.8fr);
  gap: 12px;
  align-items: end;
}

.file-row small {
  min-height: 40px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.enterprise-license-preview {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 12px;
}

.enterprise-license-preview img {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 4px;
}

.enterprise-license-preview span {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modal-grid-actions {
  grid-column: 1 / -1;
}

.admin-dialog.billing-product-type-dialog {
  width: min(720px, calc(100vw - 48px));
}

.billing-product-type-form {
  gap: 18px;
}

.billing-product-type-group {
  display: grid;
  gap: 8px;
}

.billing-product-type-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
}

.billing-product-type-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.billing-product-type-option {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.billing-product-type-option > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.billing-product-type-radio {
  width: 16px;
  height: 16px;
  border: 1.5px solid #94a3b8;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--panel);
}

.billing-product-type-copy {
  min-width: 0;
}

.billing-product-type-copy strong,
.billing-product-type-copy small {
  display: block;
  overflow-wrap: break-word;
}

.billing-product-type-copy strong {
  color: var(--text);
  font-size: var(--type-body-size);
  line-height: 1.4;
}

.billing-product-type-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--type-meta-size);
  line-height: 1.45;
}

.billing-product-type-option:has(input:checked) {
  border-color: #0f8a83;
  background: #eef8f7;
}

.billing-product-type-option:has(input:checked) .billing-product-type-radio {
  border-color: #0f8a83;
  background: #0f8a83;
}

.billing-product-type-option:hover {
  border-color: #6faaa6;
}

.billing-product-type-option:active {
  transform: translateY(1px);
}

.billing-product-type-option:has(input:focus-visible) {
  outline: 2px solid rgba(15, 138, 131, 0.28);
  outline-offset: 2px;
}

.modal-secondary {
  min-height: 40px;
  border-radius: 6px;
  background: #eef2f7;
  color: #1f2937;
  padding: 0 16px;
  font-weight: var(--type-semibold-weight);
}

/* Admin UI density and hierarchy pass */
#viewContainer {
  min-width: 0;
  display: grid;
  gap: var(--space-4);
}

.view {
  min-width: 0;
  display: grid;
  gap: var(--space-4);
}

.login-shell {
  background:
    radial-gradient(circle at 18% 18%, rgba(15, 118, 110, 0.10), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(14, 165, 233, 0.10), transparent 24%),
    var(--bg);
}

.login-panel {
  border-radius: var(--radius-panel);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.14);
}

.auth-card {
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel-soft);
}

.auth-tabs button {
  background: var(--panel);
}

.app-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  min-height: 0;
  overflow: auto;
  padding: 18px 14px;
  background:
    linear-gradient(180deg, #0f172a, #111827 54%, #0b1220),
    var(--sidebar);
  scrollbar-width: thin;
  scrollbar-color: #475569 transparent;
}

.brand {
  margin-bottom: var(--space-3);
  padding: 6px 10px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.nav {
  gap: 4px;
}

.nav-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 10px 7px;
  color: #b7c3d4;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
  letter-spacing: 0;
  line-height: 1;
}

.nav-divider::after {
  content: "";
  min-width: 24px;
  height: 1px;
  flex: 1;
  background: rgba(148, 163, 184, 0.26);
}

.nav button,
.ghost {
  min-height: 38px;
  border-radius: var(--radius-control);
}

.nav button {
  position: relative;
  color: #cbd5e1;
  padding: 0 12px 0 14px;
}

.nav button:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #fff;
}

.nav button.active,
.nav-parent.open {
  background: rgba(15, 118, 110, 0.20);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-submenu {
  margin: 2px 0 6px;
  padding-left: 12px;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.nav-child {
  min-height: 34px;
  color: #b6c2d2;
  font-size: var(--type-body-size);
}

.ghost {
  min-height: 40px;
  margin-top: var(--space-4);
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.28);
  text-align: center;
}

.ghost:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #fff;
}

.workspace {
  min-height: 100dvh;
  padding: 24px;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: flex-start;
  margin: -24px -24px 22px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 242, 247, 0.94);
  backdrop-filter: blur(10px);
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: var(--type-page-title-size);
  line-height: 1.25;
}

.view-description {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--type-body-size);
  line-height: 1.55;
}

.admin-meta {
  min-width: 180px;
  padding-top: 2px;
}

.admin-meta small {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0 10px;
  color: var(--muted);
  white-space: nowrap;
}

body.is-loading .admin-meta small {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: var(--space-3);
}

.metrics article,
.panel,
.table-wrap,
.auth-card {
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-xs);
}

.metrics article {
  min-height: 104px;
  align-content: start;
  gap: var(--space-2);
  padding: 16px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
}

.metrics span {
  font-weight: var(--type-semibold-weight);
}

.metrics strong {
  font-size: var(--type-page-title-size);
  line-height: 1.15;
}

.panel {
  padding: 16px;
  background: var(--panel);
}

.toolbar {
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-3);
}

.view > .toolbar {
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-xs);
}

.toolbar.system-tabs,
.toolbar.finance-tabs,
.toolbar.ai-prompt-tabs,
.toolbar.ai-skill-tabs,
.toolbar.enterprise-tabs,
.toolbar.enterprise-detail-tabs {
  align-items: center;
}

.primary,
.toolbar button,
.compact button,
.inline-fields button,
.row-actions button,
.pagination button,
.modal-secondary,
.tiny-button,
.model-picker-toolbar button,
.model-picker-table button,
.user-detail-actions button,
.copy-item button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #eef3f8;
  color: #263445;
  padding: 0 14px;
  font-weight: var(--type-semibold-weight);
}

.primary,
.toolbar button.primary,
.compact button.primary,
button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary:hover,
.toolbar button.primary:hover,
.compact button.primary:hover,
button.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.toolbar button:hover,
.compact button:hover,
.inline-fields button:hover,
.row-actions button:hover,
.pagination button:hover,
.modal-secondary:hover,
.tiny-button:hover,
.model-picker-toolbar button:hover,
.model-picker-table button:hover,
.user-detail-actions button:hover,
.copy-item button:hover {
  border-color: #c4cedb;
  background: #e2e8f0;
}

.toolbar.system-tabs button.active,
.toolbar.finance-tabs button.active,
.toolbar.ai-prompt-tabs button.active,
.toolbar.ai-skill-tabs button.active,
.toolbar.enterprise-detail-tabs button.active {
  border-color: var(--sidebar);
  background: var(--sidebar);
  color: #fff;
}

.danger,
.danger-button,
.row-actions button.danger,
.modal-actions .danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.danger:hover,
.danger-button:hover,
.row-actions button.danger:hover,
.modal-actions .danger:hover {
  border-color: #8f1d15;
  background: #8f1d15;
}

label {
  gap: 6px;
}

input,
select,
textarea {
  min-height: 38px;
  border-radius: var(--radius-control);
  background: #fff;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #c4cedb;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.message {
  line-height: 1.5;
}

.inline-form {
  align-items: end;
}

.config-version,
small {
  color: var(--muted);
}

.table-wrap {
  min-width: 0;
  overflow: auto;
  border-color: var(--line);
  background: var(--panel);
  scrollbar-width: thin;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  height: 44px;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 12px;
  font-size: var(--type-body-size);
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  color: #334155;
  box-shadow: inset 0 -1px 0 var(--line);
}

td {
  color: #233143;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: #f8fbfd;
}

th:last-child,
td:last-child {
  min-width: 126px;
}

td:not(:last-child) {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

.row-actions button {
  min-height: 30px;
  padding: 0 9px;
  font-size: var(--type-button-size);
}

.badge {
  min-height: 22px;
  border-radius: var(--radius-badge);
  padding: 0 7px;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.pagination {
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.pagination span {
  color: var(--muted);
  font-size: var(--type-body-size);
}

.empty-row td {
  position: sticky;
  left: 0;
  z-index: 1;
  height: 156px;
  background: var(--panel);
  text-align: center;
  white-space: normal;
}

.empty-row:hover {
  background: transparent;
}

.empty-state {
  min-height: 116px;
  width: min(560px, 100%);
  margin: 0 auto;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 24px;
  color: var(--muted);
}

.empty-state strong {
  color: #334155;
  font-size: var(--type-component-title-size);
}

.empty-state span {
  font-size: var(--type-body-size);
}

.detail-item,
.copy-item,
.admin-permission-group,
.file-row small,
.enterprise-license-preview,
.modal-summary span {
  border-radius: var(--radius-control);
  background: var(--panel-soft);
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.50);
  backdrop-filter: blur(2px);
}

.admin-dialog {
  border-radius: var(--radius-panel);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.26);
}

.modal-header {
  min-height: 60px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
}

.modal-header h2 {
  font-size: var(--type-section-title-size);
}

.modal-close {
  border: 1px solid var(--line);
  background: #eef3f8;
}

.modal-close:hover {
  background: #e2e8f0;
}

.modal-body {
  padding: 18px;
}

.modal-section + .modal-section {
  border-top-color: var(--line-soft);
}

.modal-actions {
  position: sticky;
  bottom: -18px;
  z-index: 2;
  margin: 18px -18px -18px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.modal-grid-actions {
  grid-column: 1 / -1;
}

@media (max-width: 1280px) {
  .system-config-grid-four,
  .system-upload-policy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-auth-switches {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    align-items: start;
  }

  .nav-divider {
    grid-column: 1 / -1;
    margin-top: 12px;
  }

  .nav-section {
    min-width: 0;
  }

  .ghost {
    margin-top: 12px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .split,
  .billing-form,
  .activity-form,
  .system-settings-form,
  .system-sms-forms,
  .admin-grid,
  .login-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .system-platform-heading,
  .system-config-section {
    padding-right: 14px;
    padding-left: 14px;
  }

  .system-config-section-heading {
    display: grid;
  }

  .system-config-section-heading .muted {
    text-align: left;
  }

  .system-config-grid-two,
  .system-config-grid-three,
  .system-config-grid-four,
  .system-upload-policy-grid,
  .system-auth-switches {
    grid-template-columns: 1fr;
  }

  .system-platform-actions {
    padding: 12px 14px;
  }

  .system-platform-actions button {
    width: 100%;
  }

  .workspace {
    padding: 16px;
  }

  .sidebar {
    position: relative;
    top: auto;
    z-index: 40;
    padding: 14px;
    overflow: hidden;
  }

  .brand {
    margin-bottom: 10px;
    padding: 0 2px 12px;
  }

  .nav {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-divider {
    display: none;
  }

  .nav-section {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
  }

  .nav-submenu {
    display: flex;
    gap: 8px;
    margin: 0;
    padding-left: 0;
    border-left: 0;
  }

  .nav-submenu.hidden {
    display: none;
  }

  .nav button,
  .ghost {
    width: auto;
    flex: 0 0 auto;
    min-height: 36px;
    white-space: nowrap;
  }

  .nav button.active,
  .nav-parent.open {
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .ghost {
    width: 100%;
    margin-top: 10px;
  }

  .topbar {
    margin: -16px -16px 16px;
    padding: 14px 16px;
  }

  .view-description {
    max-width: none;
  }

  .topbar,
  .toolbar,
  .inline-fields,
  .real-person-fields,
  .toolbar.ai-log-toolbar,
  .toolbar.finance-toolbar,
  .toolbar.system-tabs,
  .toolbar.enterprise-list-toolbar,
  .toolbar.enterprise-audit-toolbar,
  .enterprise-month-filter,
  .toolbar.finance-tabs,
  .toolbar.ai-prompt-tabs,
  .toolbar.log-toolbar,
  .toolbar.billing-toolbar,
  .toolbar.coupon-toolbar,
  .toolbar.banner-toolbar,
  .toolbar.agent-level-toolbar,
  .toolbar.ai-model-toolbar,
  .toolbar.ai-config-toolbar,
  .toolbar.redeem-toolbar,
  .model-picker-toolbar,
  .inline-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .pagination {
    justify-content: flex-start;
  }

  .admin-meta small {
    justify-content: flex-start;
    white-space: normal;
  }

  .admin-meta {
    justify-items: start;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 28px;
  }

  .login-panel h1 {
    font-size: var(--type-display-size);
  }

  .auth-tabs button {
    padding: 0 8px;
    font-size: var(--type-component-title-size);
  }

  .admin-dialog {
    inset: 16px 12px auto;
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 32px);
  }

  .admin-dialog.billing-product-type-dialog {
    width: calc(100vw - 24px);
  }

  .billing-product-type-options {
    grid-template-columns: 1fr;
  }

  .modal-grid,
  .detail-grid,
  .copy-grid,
  .file-row,
  .admin-permission-grid,
  .ai-model-test-options,
  .ai-model-test-form {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    border-radius: var(--radius-control);
  }

  .empty-state {
    width: calc(100vw - 64px);
    margin: 0;
  }
}

/* Reference navigation overrides (kept last so they win over legacy density rules). */
.app-shell { grid-template-columns: 272px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 16px 18px;
  background: #0e1828;
  color: #d7deea;
  scrollbar-width: auto;
  scrollbar-color: #35465c transparent;
}
.sidebar::-webkit-scrollbar { width: 16px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  min-height: 120px;
  border: 4px solid transparent;
  border-radius: 999px;
  background: #35465c;
  background-clip: padding-box;
}
.brand {
  margin: 0 0 14px;
  padding: 4px 10px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.brand strong { color: #eef5ff; font-size: 17px; }
.brand span { color: #75d8ff; font-size: 12px; }
.nav { gap: 4px; }
.nav-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin: 24px 10px 8px;
  color: #66d5ff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}
.nav-divider:first-child { margin-top: 4px; }
.nav-divider::after {
  content: "⌄";
  flex: 0 0 20px;
  width: 20px;
  height: 24px;
  color: #6edbff;
  font-size: 24px;
  font-weight: 400;
  line-height: 17px;
  text-align: center;
  background: transparent;
}
.nav button,
.ghost {
  min-height: 52px;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: 12px;
  color: #cdd5e2;
  padding: 0 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}
.nav button:hover { background: rgba(108, 128, 154, 0.14); color: #f7fbff; }
.nav button.active {
  border-left-color: #1cc7b5;
  background: #202c3b;
  color: #f8fbff;
  box-shadow: none;
}
.nav-icon {
  display: inline-grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #d3dbe7;
}
.nav-icon svg { display: block; width: 25px; height: 25px; }
.nav button:hover .nav-icon,
.nav button.active .nav-icon { color: #f7fbff; }
.nav-parent { justify-content: flex-start; color: #6edbff; }
.nav-parent > span:first-of-type { flex: 1; color: inherit; }
.nav-parent .nav-caret { flex: 0 0 auto; color: #6edbff; font-size: 22px; line-height: 1; }
.nav-parent.active,
.nav-parent.open { border-left-color: transparent; background: transparent; color: #6edbff; box-shadow: none; }
.nav-submenu {
  display: grid;
  gap: 4px;
  margin: 0 0 6px 14px;
  padding: 2px 0 2px 10px;
  border-left: 1px solid rgba(110, 219, 255, 0.18);
}
.nav-child { min-height: 44px; font-size: 15px; }
.ghost { min-height: 44px; margin-top: 18px; border-color: rgba(148, 163, 184, 0.20); background: rgba(15, 23, 42, 0.28); color: #bfc9d8; text-align: center; }
.ghost:hover { background: rgba(108, 128, 154, 0.16); color: #fff; }

@media (max-width: 1100px) {
  .sidebar { position: relative; top: auto; height: auto; min-height: auto; overflow: visible; }
}

@media (max-width: 720px) {
  .sidebar { padding: 14px; }
  .nav-divider { display: none; }
  .nav button, .ghost { min-height: 44px; font-size: 14px; }
  .nav-icon { flex-basis: 22px; width: 22px; height: 22px; }
  .nav-icon svg { width: 21px; height: 21px; }
}

/* Navigation v2: restore the original density and make every heading a real toggle. */
.app-shell { grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { padding: 18px 14px; }
.nav-group,
.nav-group-items { display: grid; gap: 4px; min-width: 0; }
.nav-subgroup { margin-top: 6px; }
.nav-subgroup .nav-divider { margin-top: 4px; }
.nav-group-items.hidden { display: none; }
.nav button:not(.nav-divider),
.ghost {
  min-height: 40px;
  border-radius: 8px;
  font-size: var(--type-body-size);
  font-weight: var(--type-semibold-weight);
}
.nav button:not(.nav-divider) { gap: 10px; padding: 0 10px; }
.nav button:not(.nav-divider).active { border-left-width: 3px; }
.nav-icon { flex-basis: 22px; width: 22px; height: 22px; }
.nav-icon svg { width: 20px; height: 20px; }
.nav button.nav-divider {
  width: 100%;
  min-height: 30px;
  margin: 14px 0 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #66d5ff;
  padding: 0 8px;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
  line-height: 1.2;
}
.nav-group:first-child .nav-divider { margin-top: 0; }
.nav button.nav-divider:hover { background: rgba(108, 128, 154, 0.08); color: #8adeff; }
.nav button.nav-divider::after { content: none; }
.nav button.nav-divider > span:first-child { flex: 1; text-align: left; }
.nav button.nav-divider .nav-caret {
  flex: 0 0 auto;
  color: #6edbff;
  font-size: 16px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}
.nav button.nav-divider.open .nav-caret { transform: rotate(90deg); }
.nav-child { min-height: 38px; font-size: var(--type-body-size); }
.ghost { font-size: var(--type-body-size); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .nav-group { display: flex; flex: 0 0 auto; }
  .nav-group-items { display: flex; flex: 0 0 auto; gap: 8px; }
  .nav-group-items.hidden { display: none; }
  .nav button:not(.nav-divider), .ghost { min-height: 38px; font-size: var(--type-body-size); }
}

/* Video super-resolution pricing: compact editable cards, without table overflow. */
.video-enhancement-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.video-enhancement-heading h3 {
  margin: 0;
}

.video-enhancement-heading .muted {
  max-width: 880px;
  margin: 6px 0 0;
}

.video-enhancement-unit-badge {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 9%, var(--panel-soft));
  color: var(--accent-dark);
  padding: 7px 10px;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
  white-space: nowrap;
}

.video-enhancement-pricing-form {
  grid-column: 1 / -1;
}

.video-enhancement-formula {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  color: var(--muted);
  padding: 11px 13px;
  font-size: var(--type-body-size);
  line-height: 1.55;
}

.video-enhancement-pricing-matrices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
  min-width: 0;
}

.video-enhancement-pricing-mode {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel-soft);
  overflow: hidden;
}

.video-enhancement-pricing-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 70%, var(--accent) 4%);
  padding: 13px 14px;
}

.video-enhancement-pricing-mode-header h4 {
  margin: 0;
  color: var(--accent-dark);
  font-size: var(--type-component-title-size);
}

.video-enhancement-pricing-mode-header > span {
  color: var(--muted);
  font-size: var(--type-button-size);
  white-space: nowrap;
}

.video-enhancement-resolution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.video-enhancement-resolution-group {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: var(--panel);
  padding: 8px 9px 10px;
}

.video-enhancement-resolution-group legend {
  width: auto;
  max-width: 100%;
  color: var(--text);
  padding: 0 5px;
  font-size: var(--type-button-size);
  font-weight: var(--type-semibold-weight);
  white-space: nowrap;
}

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

.video-enhancement-rate-control {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--type-medium-weight);
}

.video-enhancement-rate-input {
  position: relative;
  min-width: 0;
}

.video-enhancement-rate-input input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 6px 6px 7px;
  font-size: var(--type-button-size);
}

.video-enhancement-rate-input em {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  pointer-events: none;
}

.video-enhancement-rate-input input {
  padding-right: 58px;
}

.video-enhancement-billing-reference {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: var(--panel);
  padding: 0 14px;
}

.video-enhancement-billing-reference summary {
  cursor: pointer;
  color: var(--text);
  padding: 12px 0;
  font-size: var(--type-body-size);
  font-weight: var(--type-semibold-weight);
}

.video-enhancement-billing-reference > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: var(--type-button-size);
  line-height: 1.5;
}

.video-enhancement-factor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px;
  padding: 0 0 14px;
}

.video-enhancement-factor-plan {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.video-enhancement-factor-plan > strong {
  color: var(--accent-dark);
  font-size: var(--type-button-size);
}

.video-enhancement-factor-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px;
}

.video-enhancement-factor-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  padding: 10px;
}

.video-enhancement-factor-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: var(--type-button-size);
}

.video-enhancement-factor-card > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.video-enhancement-factor-card span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 88%, var(--line-soft));
  color: var(--muted);
  padding: 4px 5px;
  font-size: 10px;
  white-space: nowrap;
}

.video-enhancement-factor-card b {
  color: var(--accent-dark);
  font-weight: var(--type-semibold-weight);
}

@media (max-width: 760px) {
  .video-enhancement-heading { display: grid; }
  .video-enhancement-unit-badge { justify-self: start; }
  .video-enhancement-resolution-grid { grid-template-columns: 1fr; }
}
