:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #fff;
  --line: #e7eaf0;
  --line-strong: #d8dee8;
  --text: #101828;
  --body: #344054;
  --muted: #667085;
  --soft: #98a2b3;
  --blue: #2f6fed;
  --blue-soft: #eef3ff;
  --green: #17a673;
  --green-soft: #e7f8f1;
  --amber: #b7791f;
  --amber-soft: #fff7e6;
  --red: #e5484d;
  --red-soft: #fdebec;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--body);
  font-size: 14px;
}

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

button,
.top-actions a {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--body);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.admin-shell {
  height: 100vh;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  height: 100vh;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 900;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
}

.brand-title,
.operator-name {
  color: var(--text);
  font-weight: 850;
}

.brand-title {
  font-size: 14px;
}

.brand-subtitle,
.operator-role {
  color: var(--soft);
  font-size: 11px;
}

.nav {
  flex: 1;
  min-height: 0;
  padding: 6px 10px;
  display: grid;
  align-content: start;
  gap: 3px;
  overflow-y: auto;
}

.nav button {
  width: 100%;
  height: 40px;
  border: 0;
  background: transparent;
  justify-content: flex-start;
  gap: 10px;
  color: #475467;
}

.nav button::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d0d5dd;
}

.nav button.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.nav button.active::before {
  background: var(--blue);
}

.operator-card {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid #eef1f5;
}

.main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  min-height: 70px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 20;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--text);
  font-size: 18px;
}

h2 {
  color: var(--text);
  font-size: 15px;
}

p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-pill,
.badge {
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

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

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

.content-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}

.section {
  display: none;
  padding: 24px;
}

.section.active {
  display: block;
}

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

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(16, 24, 40, .04);
}

.kpi {
  min-height: 106px;
  padding: 14px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi-value {
  margin-top: 5px;
  color: var(--text);
  font-size: 26px;
  font-weight: 900;
}

.kpi-note {
  margin-top: 4px;
  color: var(--soft);
  font-size: 12px;
}

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

.dashboard-rank-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-rank-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-rank-toolbar button {
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--body);
  font-weight: 800;
  padding: 0 10px;
}

.dashboard-rank-toolbar button:hover,
.dashboard-rank-toolbar button.active {
  border-color: var(--blue);
  background: #eef4ff;
  color: var(--blue);
}

.compact-panel .panel-head {
  min-height: 48px;
}

.compact-rank-list {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.compact-rank-row {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.compact-rank-row strong,
.compact-rank-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-rank-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.compact-rank-row b {
  color: var(--text);
  font-size: 18px;
}

.compact-empty {
  min-height: 44px;
  padding: 12px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head {
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.integration-list,
.task-list,
.integration-editor-grid {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.collection-summary-block {
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--line);
}

.collection-summary-head {
  min-height: 38px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.collection-summary-head h3,
.platform-recent-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

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

.platform-recent-card {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  background: #fff;
}

.platform-recent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.platform-recent-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.platform-recent-stats div {
  min-width: 0;
  min-height: 52px;
  padding: 8px;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #fafbfc;
}

.platform-recent-stats strong,
.platform-recent-stats span,
.platform-recent-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-recent-stats strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
}

.platform-recent-stats span,
.platform-recent-meta {
  color: var(--muted);
  font-size: 12px;
}

.platform-recent-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.bar-list {
  padding: 14px 16px 16px;
  display: grid;
  gap: 12px;
}

.api-reserve-grid {
  padding: 14px 16px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.api-reserve-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  background: #fff;
}

.api-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.api-status-row span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #edf0f3;
  border-radius: 999px;
  background: #fafbfc;
}

.compact-stats strong {
  font-size: 15px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.bar-label strong {
  color: var(--text);
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.account-card-grid,
.operation-card-grid,
.release-card-grid,
.admin-user-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 12px;
  padding: 14px 16px 16px;
}

.account-row-list {
  display: grid;
  gap: 7px;
  padding: 10px 12px 12px;
  overflow-x: auto;
}

.account-row {
  min-width: 1040px;
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(155px, 1.1fr) minmax(265px, 1.35fr) 180px 66px minmax(340px, auto);
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  background: #fff;
}

.account-row.application-row {
  background: #fcfdff;
}

.account-row-identity,
.account-row-field,
.account-row-fields > div,
.account-row-stats > div {
  min-width: 0;
}

.account-row-identity strong,
.account-row-identity span,
.account-row-fields strong,
.account-row-fields span,
.account-row-stats strong,
.account-row-stats span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row-identity strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.account-row-identity span,
.account-row-fields span,
.account-row-stats span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}

.account-row-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.account-row-fields > div,
.account-row-stats > div {
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid #edf0f3;
  border-radius: 7px;
  background: #fafbfc;
}

.account-row-fields strong {
  margin-top: 2px;
  color: var(--body);
  font-size: 12px;
  line-height: 1.2;
}

.account-row-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.account-row-stats strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.15;
  text-align: center;
}

.account-row-stats span {
  text-align: center;
}

.account-row-status {
  display: flex;
  justify-content: center;
}

.account-row-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
}

.account-row-actions button {
  width: 56px;
  min-width: 56px;
  min-height: 30px;
  padding: 0 2px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--body);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.account-row-actions .danger-button {
  border-color: #f0b4b4;
  color: var(--red);
}

.account-row-actions button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.account-card,
.operation-card,
.release-card,
.admin-user-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  background: #fff;
}

.release-card.rollback-release {
  background: #fffdf7;
}

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

.admin-user-stat-grid strong {
  font-size: 13px;
  line-height: 1.3;
}

.operation-primary-metric {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.operation-primary-metric strong,
.operation-primary-metric span {
  display: block;
}

.operation-primary-metric strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1;
}

.operation-primary-metric span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.operation-secondary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.operation-secondary-grid > div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #edf0f3;
  border-radius: 7px;
  background: #fafbfc;
}

.operation-secondary-grid strong,
.operation-secondary-grid span {
  display: block;
}

.operation-secondary-grid strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.operation-secondary-grid span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.operations-panel,
.scripts-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 118px);
  overflow: hidden;
}

.operation-filter-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(132px, 170px)) minmax(146px, auto) repeat(2, minmax(132px, 170px)) auto;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #edf0f3;
  background: #fff;
  align-items: end;
}

.operation-filter-bar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.operation-filter-bar input,
.operation-filter-bar select {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--body);
  padding: 0 10px;
}

.lifecycle-fixed-rule {
  min-height: 34px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.lifecycle-policy-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #edf0f3;
  background: #fff;
}

.lifecycle-policy-control,
.lifecycle-fixed-rule,
.lifecycle-save-button {
  min-height: 62px;
  margin: 0;
}

.lifecycle-policy-control {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.lifecycle-policy-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lifecycle-policy-control select {
  height: 30px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.lifecycle-save-button {
  width: 100%;
  border-radius: 8px;
  font-size: 14px;
}

.lifecycle-fixed-rule strong {
  color: var(--text);
  font-size: 12px;
}

.lifecycle-fixed-rule span {
  color: var(--muted);
  font-size: 11px;
}

.quick-range-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
}

.quick-range-group button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--body);
  font-weight: 800;
  padding: 0 10px;
}

.quick-range-group button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.filter-query-button {
  min-height: 34px;
  white-space: nowrap;
}

.operation-scroll {
  min-height: 0;
  max-height: calc(100vh - 322px);
  overflow-y: auto;
}

.operation-scroll .operation-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  padding: 12px 16px;
}

.operation-explainer {
  display: grid;
  gap: 4px;
  padding: 10px 16px;
  border-top: 1px solid #edf0f3;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.operation-explainer strong {
  color: var(--text);
}

.scripts-panel .task-list {
  padding: 0;
  gap: 6px;
}

.scripts-panel .task-item {
  min-height: 0;
  padding: 8px 10px;
}

.release-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  padding: 12px 16px;
}

.release-card {
  gap: 8px;
  padding: 10px;
}

.release-card .account-card-head h3 {
  font-size: 14px;
}

.release-card .account-card-head p,
.release-card .account-card-meta,
.release-card .account-card-note {
  font-size: 11px;
}

.release-card .account-stat-grid {
  gap: 6px;
}

.release-card .account-stat-grid > div {
  padding: 7px;
}

.release-card .account-stat-grid strong {
  font-size: 15px;
}

.release-card .account-card-note {
  max-height: 42px;
  overflow: hidden;
  padding: 7px 8px;
}

.release-card .account-card-meta {
  gap: 3px;
}

.release-card .card-actions button,
.release-card .card-actions a {
  min-height: 28px;
  padding: 0 8px;
}

.application-card {
  background: #fcfdff;
}

.account-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.account-card-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.account-card-head p {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

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

.account-stat-grid > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid #edf0f3;
  border-radius: 7px;
  background: #fafbfc;
}

.account-stat-grid strong,
.account-stat-grid span {
  display: block;
}

.account-stat-grid strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.account-stat-grid span,
.account-card-meta,
.account-card-note,
.release-download {
  color: var(--muted);
  font-size: 12px;
}

.account-stat-grid span {
  margin-top: 4px;
}

.account-card-meta {
  display: grid;
  gap: 5px;
}

.account-card-note,
.release-download {
  padding: 8px 10px;
  border: 1px solid #edf0f3;
  border-radius: 7px;
  background: #fafbfc;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.activation-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #f1d48b;
  border-radius: 8px;
  background: #fff8e6;
  color: #7a4a00;
}

.activation-summary strong {
  font-size: 15px;
}

.activation-summary span {
  color: #8a6423;
  font-size: 13px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-actions button,
.card-actions a {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-decoration: none;
}

.danger-button {
  border-color: #f0b4b4;
  color: var(--red);
}

.rank-index {
  display: inline-grid;
  width: 24px;
  height: 24px;
  margin-right: 7px;
  place-items: center;
  border: 1px solid #e3bd55;
  border-radius: 6px;
  background: #fff8df;
  color: #765300;
  font-size: 12px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

.integration-item,
.task-item,
.integration-card {
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #fafbfc;
  padding: 10px 12px;
}

.integration-item,
.task-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.integration-card {
  display: grid;
  gap: 10px;
  background: #fff;
}

.integration-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

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

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--text);
}

input,
select {
  height: 34px;
  padding: 0 10px;
}

textarea {
  min-height: 170px;
  padding: 10px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-row label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
}

.toggle-row input {
  width: auto;
  height: auto;
}

.table-wrap {
  overflow: auto;
}

.diagnostic-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #edf0f3;
}

.diagnostic-summary-card {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.diagnostic-summary-card strong {
  color: var(--ink);
  font-size: 20px;
}

.diagnostic-summary-card span,
.diagnostic-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.diagnostic-detail {
  max-width: 460px;
}

.diagnostic-detail summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
}

.diagnostic-detail pre {
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f3;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  background: #fafbfc;
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

td {
  color: var(--body);
}

.text-cell {
  max-width: 280px;
  overflow-wrap: anywhere;
}

.script-copy-cell {
  min-width: 260px;
  max-width: 360px;
  line-height: 1.35;
}

.script-copy-cell strong,
.script-copy-cell span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.script-copy-cell strong {
  -webkit-line-clamp: 2;
  font-size: 13px;
}

.script-copy-cell span {
  -webkit-line-clamp: 2;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.script-link-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.script-link-actions a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.script-link-actions .small {
  padding: 5px 8px;
  min-height: 0;
  font-size: 12px;
}

.link-missing {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.scripts-panel table th,
.scripts-panel table td {
  padding-top: 8px;
  padding-bottom: 8px;
  vertical-align: top;
}

.import-grid {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .45fr);
  gap: 12px;
  border-bottom: 1px solid #edf0f3;
}

.account-workspace {
  margin-bottom: 16px;
}

.account-workspace-head {
  align-items: center;
}

.account-ledger-scroll {
  --account-ledger-columns: 230px 140px minmax(170px, 1fr) 150px 68px 68px 68px 126px 250px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}

.account-row-columns {
  min-width: 1338px;
  display: grid;
  grid-template-columns: var(--account-ledger-columns);
  align-items: center;
  gap: 6px;
  padding: 8px 22px 7px;
  border-bottom: 1px solid #edf0f3;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
}

.account-row-columns span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row-columns span:nth-child(n + 5):nth-child(-n + 8),
.account-row-columns span:last-child {
  text-align: center;
}

.account-row-columns span:first-child,
.account-row-columns span:nth-child(8),
.account-row-columns span:last-child {
  position: sticky;
  z-index: 3;
  align-self: stretch;
  display: grid;
  align-content: center;
  background: #f8fafc;
}

.account-row-columns span:first-child {
  left: 0;
}

.account-row-columns span:nth-child(8) {
  right: 250px;
}

.account-row-columns span:last-child {
  right: 0;
}

#customerCards.account-row-list {
  padding-top: 8px;
  overflow: visible;
}

#customerCards .account-row {
  min-width: 1338px;
  min-height: 82px;
  grid-template-columns: var(--account-ledger-columns);
  align-items: stretch;
  gap: 6px;
}

#customerCards .account-row-fields,
#customerCards .account-row-stats {
  display: contents;
}

#customerCards .account-row-identity,
#customerCards .account-row-fields > div,
#customerCards .account-row-stats > div,
#customerCards .account-row-status,
#customerCards .account-row-actions {
  min-height: 54px;
  align-content: center;
}

#customerCards .account-row-identity {
  position: sticky;
  left: 0;
  z-index: 2;
  display: grid;
  padding-right: 10px;
  background: #fff;
  box-shadow: 8px 0 12px -14px rgba(15, 23, 42, .65);
}

#customerCards .application-row .account-row-identity {
  background: #fcfdff;
}

#customerCards .account-row-fields > div,
#customerCards .account-row-stats > div {
  display: grid;
  min-height: 54px;
  align-content: center;
  padding: 5px 8px;
  border: 0;
  border-left: 1px solid #edf0f3;
  border-radius: 0;
  background: transparent;
}

#customerCards .account-row-fields strong {
  overflow: visible;
  text-overflow: clip;
}

#customerCards .account-row-stats strong,
#customerCards .account-row-stats span {
  text-align: center;
}

#customerCards .account-row-status {
  position: sticky;
  right: 250px;
  z-index: 2;
  justify-content: center;
  align-content: center;
  padding-inline: 4px;
  border-left: 1px solid #edf0f3;
  background: #fff;
  box-shadow: -8px 0 12px -14px rgba(15, 23, 42, .65);
}

#customerCards .application-row .account-row-status {
  background: #fcfdff;
}

#customerCards .account-row-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  display: grid;
  justify-content: stretch;
  gap: 4px;
  padding-left: 8px;
  border-left: 1px solid #edf0f3;
  background: #fff;
  box-shadow: -8px 0 12px -14px rgba(15, 23, 42, .65);
}

#customerCards .application-row .account-row-actions {
  background: #fcfdff;
}

.account-action-line {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.account-action-line > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.account-action-line > div {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 3px;
}

#customerCards .account-row-actions button {
  width: 58px;
  min-width: 58px;
  min-height: 29px;
  font-size: 10px;
}

.account-filter-bar {
  display: grid;
  grid-template-columns: minmax(250px, 1.55fr) minmax(152px, .75fr) minmax(152px, .75fr) 96px 70px minmax(96px, auto);
  gap: 8px;
  align-items: end;
  padding: 10px 16px;
  border-bottom: 1px solid #edf0f3;
  background: #fff;
}

.account-filter-bar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-filter-bar input,
.account-filter-bar select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--body);
}

.account-filter-bar > button {
  min-height: 34px;
  padding: 0 8px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--amber);
}

.account-row-status {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.account-alert-chip {
  min-height: 23px;
  max-width: 100%;
  padding: 0 6px;
  border-color: #f2c2c4;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 10px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-note,
.dialog-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.dialog-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.lifecycle-policy-dialog {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px 0 0;
  border-bottom: 0;
}

.lifecycle-dialog-cards {
  max-height: 310px;
  overflow: auto;
  padding: 10px 0 0;
}

#accessLifecycleDialog {
  width: min(900px, calc(100vw - 32px));
}

#accountAlertDialog {
  width: min(760px, calc(100vw - 32px));
}

#accountAlertDialog .dialog-head {
  align-items: flex-start;
  padding-top: 14px;
  padding-bottom: 14px;
}

#accountAlertDialog .dialog-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.account-alert-dialog-body {
  display: grid;
  gap: 8px;
  max-height: min(64vh, 620px);
  overflow: auto;
}

.account-alert-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #fafbfc;
}

.account-alert-detail > div {
  display: grid;
  gap: 3px;
}

.account-alert-detail strong {
  color: var(--text);
  font-size: 13px;
}

.account-alert-detail span,
.account-alert-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.account-alert-detail p {
  grid-column: 1 / -1;
}

.account-alert-detail button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 156px;
}

.table-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

dialog {
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .24);
}

dialog::backdrop {
  background: rgba(16, 24, 40, .42);
}

.dialog-head {
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
}

.dialog-body {
  padding: 16px;
}

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

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.activation-result {
  min-height: 22px;
  margin-top: 14px;
  border-radius: 7px;
  color: var(--green);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.6;
}

pre {
  margin: 0;
  min-height: 170px;
  max-height: 240px;
  overflow: auto;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #111827;
  color: #d1fae5;
  padding: 12px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .admin-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    width: auto;
    height: auto;
    min-height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav button {
    min-width: 128px;
  }

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

  .form-grid .wide {
    grid-column: auto;
  }

  .account-card-grid,
  .operation-card-grid,
  .release-card-grid,
  .admin-user-card-grid {
    grid-template-columns: 1fr;
  }

  .lifecycle-policy-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operations-panel,
  .scripts-panel,
  .operation-scroll {
    max-height: none;
    overflow: visible;
  }

  .operation-filter-bar {
    position: static;
    grid-template-columns: 1fr;
  }

  .account-filter-bar,
  .lifecycle-policy-dialog {
    grid-template-columns: 1fr;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .content-scroll {
    overflow: visible;
  }

  .kpi-grid,
  .diagnostic-summary-grid,
  .split-grid,
  .api-reserve-grid,
  .platform-recent-grid,
  .platform-recent-stats,
  .platform-recent-meta,
  .integration-editor-grid,
  .form-grid,
  .import-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .lifecycle-policy-bar {
    grid-template-columns: 1fr;
  }
}
 .admin-login-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 20px 48px rgba(20, 39, 69, 0.2);
 }

 .admin-login-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
 .admin-login-dialog form { display: grid; gap: 14px; }
 .admin-login-dialog .brand-mark { width: 64px; height: 64px; margin-bottom: 4px; }
 .admin-login-dialog h1 { margin: 0; font-size: 22px; }
 .admin-login-dialog p { margin: 0; color: #64748b; line-height: 1.6; }
 .admin-login-dialog label { display: grid; gap: 6px; color: #475569; font-weight: 700; }
 .admin-login-dialog input { min-height: 42px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 12px; font: inherit; }
 .admin-login-dialog .form-error { min-height: 20px; color: #dc2626; font-size: 13px; }
