:root {
  --mh-primary: #4f46e5;
  --mh-primary-hover: #4338ca;
  --mh-primary-soft: #eef2ff;
  --mh-ink: #0f172a;
  --mh-text-secondary: #64748b;
  --mh-text-muted: #94a3b8;
  --mh-canvas: #f4f6fb;
  --mh-surface: #ffffff;
  --mh-border: #e2e8f0;
  --mh-success: #16a34a;
  --mh-warning: #d97706;
  --mh-danger: #dc2626;
  --mh-radius-control: 10px;
  --mh-radius-card: 14px;
  --mh-shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

html,
body,
#root {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--mh-canvas);
  color: var(--mh-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.full-width {
  width: 100%;
}

.admin-layout {
  min-height: 100vh;
}

.admin-sider {
  background: var(--mh-ink) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  position: sticky !important;
  top: 0;
  z-index: 20;
}

.admin-sider-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
}

.admin-sider .admin-menu {
  background: transparent;
  border-inline-end: none !important;
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
}

.admin-sider .ant-menu-dark.ant-menu-inline .ant-menu-item {
  border-radius: 10px;
  height: 40px;
  line-height: 40px;
  margin-block: 2px;
  width: 100%;
}

.admin-sider .ant-menu-dark .ant-menu-item-selected {
  background: rgba(79, 70, 229, 0.22) !important;
  color: #e0e7ff !important;
}

.admin-sider .ant-menu-dark .ant-menu-item-selected .anticon {
  color: #c7d2fe;
}

.admin-sider .ant-menu-dark .ant-menu-item:not(.ant-menu-item-selected):hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #f8fafc !important;
}

.admin-sider .ant-menu-dark .ant-menu-item-group-title {
  color: rgba(255, 255, 255, 0.38);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 16px 12px 8px;
  text-transform: uppercase;
}

.admin-sider-footer {
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding: 14px 16px 16px;
}

.sider-user-avatar {
  background: rgba(99, 102, 241, 0.35) !important;
  color: #e0e7ff !important;
  flex-shrink: 0;
}

.sider-user-meta {
  min-width: 0;
}

.sider-user-name {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sider-user-role {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  text-transform: capitalize;
}

.brand {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  min-height: 72px;
  padding: 18px 20px;
}

.brand-logo {
  align-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  height: 36px;
  justify-content: center;
  letter-spacing: 0.02em;
  width: 36px;
}

.brand-title {
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  line-height: 1.3;
  margin-top: 2px;
}

.admin-header {
  align-items: center;
  background: var(--mh-surface);
  border-bottom: 1px solid var(--mh-border);
  display: flex;
  height: auto;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.header-breadcrumb.ant-breadcrumb {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.header-breadcrumb .ant-breadcrumb-link {
  color: var(--mh-ink);
}

.header-actions {
  flex-shrink: 0;
}

.runtime-line {
  font-size: 13px;
}

.user-button {
  padding-inline: 10px;
}

.admin-content {
  background: var(--mh-canvas);
  padding: 28px 28px 40px;
}

.ant-card {
  border-color: var(--mh-border);
  box-shadow: var(--mh-shadow-card);
}

.metric-value {
  margin: 8px 0 0 !important;
}

.metric-card {
  min-height: 122px;
}

.chart-card .ant-card-body {
  min-height: 364px;
}

.language-select {
  min-width: 116px;
}

.token-list-alert {
  margin-bottom: 16px;
}

.token-secret-alert {
  border: 1px solid #fecaca;
  background: #fef2f2;
}

.token-secret-alert .ant-alert-message {
  color: #991b1b;
  font-weight: 600;
}

.api-doc-list {
  color: #475569;
  margin: 0;
  padding-left: 18px;
}

.api-doc-list li + li {
  margin-top: 8px;
}

.inline-code-value {
  max-width: min(620px, 64vw);
  overflow-wrap: anywhere;
  white-space: normal;
}

.trend-bars {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  min-height: 260px;
}

.trend-bar-item {
  align-items: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.trend-bar-track {
  align-items: end;
  background: #edf3fb;
  border-radius: 8px;
  display: flex;
  height: 210px;
  overflow: hidden;
  width: 100%;
}

.trend-bar-fill {
  background: var(--mh-primary);
  border-radius: 8px 8px 0 0;
  width: 100%;
}

.health-row {
  align-items: center;
  border-bottom: 1px solid #eef2f7;
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
}

.health-row > div {
  display: grid;
  gap: 2px;
}

.page-toolbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.toolbar-search {
  width: 260px;
}

.toolbar-select {
  min-width: 180px;
}

.table-link {
  font-weight: 600;
  padding: 0;
}

.domains-toolbar-card .ant-card-body {
  padding: 16px 20px;
}

.domain-health-card {
  background: var(--mh-surface);
  border: 1px solid var(--mh-border);
  border-radius: var(--mh-radius-card);
  box-shadow: var(--mh-shadow-card);
  padding: 28px;
}

.domain-title-row {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.domain-title-row__text {
  min-width: 0;
}

.domain-health-card__eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.domain-health-card__title {
  margin: 6px 0 0 !important;
  overflow-wrap: anywhere;
}

.domain-health-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.domain-health-stat {
  background: #f8fafc;
  border: 1px solid var(--mh-border);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
}

.domain-health-stat__label {
  font-size: 12px;
}

.domain-health-stat__value {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.health-progress {
  display: grid;
  gap: 8px;
}

.health-progress > div {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.domain-health-meta {
  margin-top: 2px;
}

.domain-action-panel {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--mh-border);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.dns-record-card .ant-card-head-title {
  min-width: 0;
}

.dns-record-card__label {
  font-weight: 600;
}

.dns-record-card__type {
  font-size: 12px;
}

.dns-value-row {
  display: grid;
  gap: 8px;
}

.dns-value-row .code-block {
  width: 100%;
}

.dns-code-block {
  display: block;
  margin: 0 !important;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.dns-empty-value {
  margin: 6px 0 0 !important;
}

.value-stack {
  margin-top: 8px;
}

.domain-detail-tabs .ant-tabs-nav {
  margin-bottom: 16px;
}

.domain-danger-card {
  border-color: #fecaca;
}

.add-domain-drawer .add-domain-steps {
  margin-bottom: 4px;
}

.code-sample {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.delivery-log-card .ant-timeline {
  margin-top: 6px;
}

.delivery-log-entry {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.delivery-log-line {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: 18px minmax(0, 1fr);
}

.delivery-log-line .ant-typography {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.drawer-footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.confirm-list {
  color: #475569;
  margin: 0 0 16px;
  padding-left: 18px;
}

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

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

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

.table-select {
  min-width: 120px;
}

.auth-page {
  background:
    radial-gradient(circle at 12% 10%, rgba(79, 70, 229, 0.14), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(99, 102, 241, 0.08), transparent 26%),
    linear-gradient(135deg, var(--mh-canvas) 0%, var(--mh-primary-soft) 52%, var(--mh-canvas) 100%);
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  min-height: 100vh;
}

.auth-brand-panel {
  background: var(--mh-ink);
  color: #fff;
  display: grid;
  gap: 32px;
  grid-template-rows: 1fr auto;
  padding: 56px;
}

.auth-brand-top {
  align-content: center;
  display: grid;
  gap: 20px;
  max-width: 520px;
}

.auth-brand-top h1 {
  color: #fff;
  font-size: 46px;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0 0 10px !important;
}

.auth-brand-top .ant-typography {
  color: rgba(255, 255, 255, 0.72);
}

/* Inherits admin .brand-logo gradient; oversized for auth hero */
.auth-logo {
  border-radius: var(--mh-radius-control);
  font-size: 16px;
  height: 52px;
  width: 52px;
}

.auth-signal-list {
  display: grid;
  gap: 12px;
  max-width: 520px;
}

.auth-signal-item {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--mh-radius-card);
  display: flex;
  gap: 14px;
  padding: 16px;
}

.auth-signal-item > span {
  align-items: center;
  background: rgba(79, 70, 229, 0.22);
  border: 1px solid rgba(165, 180, 252, 0.28);
  border-radius: var(--mh-radius-control);
  color: #c7d2fe;
  display: inline-flex;
  font-size: 22px;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.auth-signal-item .ant-typography {
  color: rgba(255, 255, 255, 0.58);
  margin: 0 !important;
}

.auth-signal-item h5.ant-typography {
  color: #fff;
}

.auth-form-panel {
  align-content: center;
  display: grid;
  justify-items: center;
  padding: 48px 28px;
  position: relative;
}

.auth-language-row {
  position: absolute;
  right: 28px;
  top: 24px;
}

.auth-card {
  background: var(--mh-surface);
  border-color: var(--mh-border);
  border-radius: var(--mh-radius-card);
  box-shadow: var(--mh-shadow-card);
  max-width: 456px;
  overflow: hidden;
  width: 100%;
}

.auth-card .ant-card-body {
  padding: 36px;
}

.auth-heading h2 {
  color: var(--mh-ink);
  margin: 6px 0 0 !important;
}

.auth-link-row {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.auth-eyebrow {
  color: var(--mh-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Shared presentation components */

.page-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 4px;
}

.page-header__text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.page-header__title {
  margin: 0 !important;
}

.page-header__subtitle {
  display: block;
}

.page-header__extra {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.metric-card--warning .metric-value {
  color: var(--mh-warning);
}

.metric-card--danger .metric-value {
  color: var(--mh-danger);
}

.metric-card__hint {
  display: block;
  margin-top: 4px;
}

.section-card {
  border-radius: var(--mh-radius-card);
  box-shadow: var(--mh-shadow-card);
}

.section-card .section-card {
  box-shadow: none;
  background: #f8fafc;
  border-color: var(--mh-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-pill--success {
  background: #ecfdf5;
  color: #15803d;
  border-color: #bbf7d0;
}

.status-pill--warning {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.status-pill--error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-pill--info {
  background: var(--mh-primary-soft);
  color: #4338ca;
  border-color: #c7d2fe;
}

.status-pill--neutral {
  background: #f8fafc;
  color: #475569;
  border-color: var(--mh-border);
}

.empty-state {
  padding: 24px 12px;
}

.code-block {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--mh-border);
  border-radius: 10px;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
}

.code-block__value {
  flex: 1;
  margin: 0 !important;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block__copy {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .admin-header,
  .page-toolbar,
  .domain-title-row,
  .health-progress > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-header {
    gap: 12px;
    position: static;
  }

  .admin-sider {
    height: auto;
    max-height: none;
    position: static !important;
  }

  .admin-content {
    padding: 16px 16px 28px;
  }

  .admin-sider .admin-menu {
    overflow-y: visible;
  }

  .toolbar-search,
  .toolbar-select {
    width: 100%;
  }

  .domain-health-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .domain-health-card {
    padding: 20px;
  }

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

  .dns-value-row {
    grid-template-columns: 1fr;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-brand-panel {
    gap: 22px;
    grid-template-rows: auto auto;
    padding: 34px 22px;
  }

  .auth-brand-top h1 {
    font-size: 34px;
  }

  .auth-form-panel {
    padding: 28px 16px 34px;
  }

  .auth-language-row {
    justify-self: end;
    margin-bottom: 14px;
    position: static;
  }

  .auth-card .ant-card-body {
    padding: 24px;
  }
}
