:root {
  --bg: #f8f9fa;
  --bg-muted: #eef2f6;
  --surface: #ffffff;
  --surface-muted: #f6f8fb;
  --surface-soft: #fbfcfe;
  --text: #202124;
  --text-muted: #5f6368;
  --text-soft: #80868b;
  --line: #e0e3e7;
  --line-strong: #d2d7de;
  --primary: #1a73e8;
  --primary-strong: #174ea6;
  --primary-soft: #e8f0fe;
  --success: #188038;
  --success-soft: #e6f4ea;
  --warning: #b06000;
  --warning-soft: #fef7e0;
  --danger: #d93025;
  --danger-soft: #fce8e6;
  --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.12);
  --shadow-md: 0 8px 28px rgba(60, 64, 67, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[x-cloak],
[v-cloak] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Google Sans Text", "Google Sans", "Roboto", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(26, 115, 232, 0.08), transparent 28%),
    linear-gradient(180deg, #f8f9fa 0%, #f3f6fb 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.02em;
  font-weight: 500;
}

h1 {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.08;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  font-size: 22px;
  line-height: 1.2;
}

h4 {
  font-size: 18px;
  line-height: 1.3;
}

.dashboard-page,
.auth-page {
  min-height: 100vh;
}

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 24px;
}

.app-main {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.side-nav {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.nav-brand,
.header-copy,
.header-aside,
.topbar-copy,
.auth-copy,
.auth-card,
.panel,
.detail-panel {
  min-width: 0;
}

.nav-brand p,
.nav-card p {
  color: var(--text-muted);
  line-height: 1.6;
}

.nav-brand h2 {
  margin-top: 6px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text-muted);
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-link:hover {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--text);
}

.nav-link.active {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.16);
  color: var(--primary-strong);
  font-weight: 600;
}

.nav-link.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.nav-card,
.info-tile,
.stat-card,
.meta-row,
.fixed-target,
.detail-chip,
.traffic-grid > div,
.uptime-ring-core,
.probe-log-item {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.nav-card,
.info-tile,
.stat-card,
.meta-row,
.fixed-target,
.detail-chip,
.traffic-grid > div,
.probe-log-item {
  padding: 18px;
}

.nav-card span,
.info-tile span,
.stat-card span,
.meta-row span,
.fixed-target span,
.detail-chip span,
label span,
.search-shell span,
.traffic-grid span,
.uptime-ring-core span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.nav-card strong,
.info-tile strong,
.stat-card strong,
.meta-row strong,
.fixed-target strong,
.detail-chip strong,
.traffic-grid strong,
.uptime-ring-core strong {
  display: block;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.nav-card p,
.info-tile small,
.stat-card small,
.panel-head p,
.section-head p,
.inner-panel-head p,
.subscription-shell-head p,
.page-subtitle,
.detail-copy,
.table-primary span,
.table-muted,
.subscription-alert p,
.port-card-summary,
.record-note,
.status-summary,
.source-card small,
.probe-log-item span {
  color: var(--text-muted);
}

.info-tile small,
.stat-card small,
.meta-row small,
.subscription-alert p,
.probe-log-item span {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.eyebrow,
.section-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}

.page-title {
  max-width: 16ch;
}

.page-subtitle {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.65;
}

.topbar,
.panel-head,
.section-head,
.detail-head,
.subscription-shell-head,
.banner-row,
.detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.topbar-actions,
.header-actions,
.actions,
.button-row,
.status-filters,
.chart-legend,
.section-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-actions {
  justify-content: flex-end;
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.inline-form {
  margin: 0;
}

.nav-form button {
  width: 100%;
}

.page-header,
.panel,
.detail-panel,
.table-card,
.auth-copy,
.auth-card,
.empty-state,
.detail-placeholder {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.page-header,
.panel,
.detail-panel,
.auth-copy,
.auth-card {
  padding: 24px;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 20px;
}

.header-aside {
  display: grid;
  gap: 14px;
}

.quick-info-grid,
.stats-grid,
.workspace-grid,
.subscription-overview,
.traffic-grid,
.meta-strip,
.auth-highlights,
.tenant-content,
.uptime-meta {
  display: grid;
  gap: 14px;
}

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

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
}

.stat-card {
  min-height: 132px;
}

.stat-card strong {
  font-size: 32px;
  line-height: 1.05;
}

.stat-card-emphasis {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-color: rgba(26, 115, 232, 0.16);
}

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

.workspace-card {
  min-height: 100%;
}

.panel-head,
.section-head,
.inner-panel-head,
.subscription-shell-head {
  margin-bottom: 16px;
}

.panel-head p,
.section-head p,
.inner-panel-head p,
.subscription-shell-head p {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
}

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

.subscription-alert {
  padding: 18px;
  border: 1px solid rgba(217, 48, 37, 0.16);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
}

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

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

.compact {
  margin-top: 0;
}

.editor-grid .full,
.subscription-grid .full {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

label {
  display: block;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input[readonly] {
  background: var(--surface-muted);
}

input:focus {
  border-color: rgba(26, 115, 232, 0.46);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.fixed-target {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.search-shell {
  display: grid;
  gap: 8px;
  min-width: min(320px, 100%);
}

.actions {
  grid-column: 1 / -1;
  padding-top: 4px;
}

button,
.filter-pill,
.link-pill,
.text-button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  box-shadow: none;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.28);
}

.secondary,
.link-pill {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.16);
  color: var(--primary-strong);
}

.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(217, 48, 37, 0.24);
}

.filter-pill {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text-muted);
}

.filter-pill.active {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.16);
  color: var(--primary-strong);
}

.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
}

.button-link {
  text-decoration: none;
}

.status-pill,
.probe-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.good,
.badge.active,
.badge.ok,
.probe-pill.healthy {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.bad,
.badge.disabled,
.badge.bad,
.probe-pill.unhealthy {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.expired,
.badge.quota,
.badge.warn,
.probe-pill.unknown {
  background: var(--warning-soft);
  color: var(--warning);
}

.commerce-card {
  display: grid;
  gap: 12px;
}

.commerce-card-copy {
  color: var(--text-muted);
  line-height: 1.6;
}

.commerce-plan-list,
.commerce-order-list {
  display: grid;
  gap: 16px;
}

.commerce-plan-item,
.commerce-order-card,
.commerce-order-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.commerce-plan-head,
.commerce-order-head,
.commerce-order-item,
.commerce-order-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.commerce-plan-head p,
.commerce-order-head p,
.commerce-order-item p {
  margin-top: 6px;
  color: var(--text-muted);
  line-height: 1.5;
}

.commerce-order-item {
  color: inherit;
}

.commerce-order-meta {
  align-items: center;
}

.payment-proof-preview {
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.payment-proof-preview img {
  display: block;
  max-width: min(100%, 320px);
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.subscription-alert.success {
  border-color: rgba(24, 128, 56, 0.16);
  background: var(--success-soft);
  color: var(--success);
}

.status-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.ok,
.probe-text.healthy {
  color: var(--success);
}

.warn,
.probe-text.unknown {
  color: var(--warning);
}

.bad,
.probe-text.unhealthy {
  color: var(--danger);
}

.banner {
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  font-weight: 500;
}

.banner.success {
  background: var(--success-soft);
  border-color: rgba(24, 128, 56, 0.16);
  color: var(--success);
}

.banner.error {
  background: var(--danger-soft);
  border-color: rgba(217, 48, 37, 0.16);
  color: var(--danger);
}

.banner.info {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.16);
  color: var(--primary-strong);
}

.ghost-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.ports-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

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

.section-toolbar {
  justify-content: space-between;
}

.table-card {
  display: grid;
  gap: 14px;
}

.table-primary {
  display: grid;
  gap: 4px;
}

.table-primary strong {
  font-size: 15px;
  line-height: 1.35;
}

.table-primary span,
.table-muted {
  font-size: 13px;
  line-height: 1.45;
}

.table-empty,
.empty-state,
.detail-placeholder {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
}

.ports-layout .detail-panel {
  display: grid;
  gap: 16px;
}

.detail-copy {
  margin-top: 10px;
  line-height: 1.6;
}

.detail-chip-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: min(280px, 100%);
}

.inner-panel {
  padding: 18px;
}

.traffic-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.port-list,
.record-list,
.source-grid {
  display: grid;
  gap: 14px;
}

.port-card,
.record-card,
.source-card,
.status-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.port-card,
.record-card,
.source-card,
.status-card,
.inner-panel {
  padding: 18px;
}

.port-card.selected {
  border-color: rgba(26, 115, 232, 0.24);
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.08);
}

.port-card-toggle {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: grid;
  gap: 14px;
}

.port-card-head,
.record-head,
.record-title-row,
.copy-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.port-card-title,
.record-title-group {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.port-card-title strong,
.record-title {
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.port-card-summary,
.record-note,
.status-summary,
.copy-value,
.source-card small {
  margin: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.port-card-grid,
.record-kv-grid,
.status-grid {
  display: grid;
  gap: 12px;
}

.port-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.record-kv-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.status-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.port-card-stat,
.record-kv,
.record-emphasis {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
}

.port-card-stat span,
.record-kv span,
.record-emphasis span,
.source-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.port-card-stat strong,
.record-kv strong,
.record-emphasis strong,
.source-card strong,
.status-card strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.record-emphasis strong,
.source-card strong {
  font-size: 20px;
}

.source-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.source-card {
  display: grid;
  gap: 8px;
}

.subscription-grid {
  display: grid;
  gap: 12px;
}

.copy-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.copy-value {
  min-width: 0;
  color: var(--text);
}

.compact-copy-block {
  min-height: 100%;
}

.copy-button {
  min-width: 76px;
  white-space: nowrap;
}

.meta-strip {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  flex: 1 1 400px;
}

.action-row {
  justify-content: flex-end;
}

.compact-row {
  flex-wrap: wrap;
}

.tenant-content {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: start;
}

.auth-page {
  display: grid;
  align-items: center;
  padding: 24px 0;
}

.auth-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 24px;
}

.auth-copy {
  display: grid;
  gap: 20px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(232, 240, 254, 0.76) 0%, rgba(255, 255, 255, 0.98) 72%),
    var(--surface);
}

.auth-copy .page-title {
  max-width: 10ch;
}

.auth-card {
  display: grid;
  gap: 18px;
  align-content: start;
}

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

.probe-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
}

.uptime-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.uptime-ring {
  display: grid;
  place-items: center;
}

.uptime-ring-fill {
  --uptime-angle: calc(var(--uptime) * 3.6deg);
  width: 196px;
  height: 196px;
  padding: 16px;
  border-radius: 50%;
  background:
    conic-gradient(var(--success) 0deg var(--uptime-angle), rgba(217, 48, 37, 0.2) var(--uptime-angle) 360deg);
}

.uptime-ring-core {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  text-align: center;
}

.uptime-ring-core strong {
  font-size: 36px;
  line-height: 1.05;
}

.timeline-shell {
  display: grid;
  gap: 16px;
}

.status-card {
  display: grid;
  gap: 10px;
}

.status-card.healthy {
  border-color: rgba(24, 128, 56, 0.18);
  background: linear-gradient(180deg, rgba(230, 244, 234, 0.92) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.status-card.unhealthy {
  border-color: rgba(217, 48, 37, 0.18);
  background: linear-gradient(180deg, rgba(252, 232, 230, 0.92) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.status-card strong,
.probe-log-item strong,
.probe-log-item span {
  display: block;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 50%;
}

.legend-dot.healthy {
  background: var(--success);
}

.legend-dot.unhealthy {
  background: var(--danger);
}

.probe-log {
  display: grid;
  gap: 12px;
}

.probe-log-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.probe-log-item > div {
  min-width: 0;
}

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

  .side-nav {
    position: static;
  }

  .page-header,
  .workspace-grid,
  .ports-layout,
  .tenant-content,
  .probe-layout,
  .uptime-hero,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .ports-layout .detail-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .page-header,
  .quick-info-grid,
  .subscription-overview,
  .auth-highlights,
  .editor-grid,
  .detail-chip-group {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head,
  .section-head,
  .detail-head,
  .subscription-shell-head,
  .detail-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .section-toolbar,
  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell,
  .auth-shell {
    width: min(100vw - 20px, 100%);
  }

  .side-nav,
  .page-header,
  .panel,
  .detail-panel,
  .auth-copy,
  .auth-card,
  .table-empty,
  .empty-state,
  .detail-placeholder {
    padding: 18px;
    border-radius: var(--radius-lg);
  }

  .search-shell {
    min-width: 0;
  }

  .status-filters,
  .header-actions,
  .button-row,
  .chart-legend {
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .topbar-badge,
  .status-pill,
  .probe-pill,
  .badge,
  button,
  .filter-pill,
  .link-pill {
    width: 100%;
  }

  .topbar-actions,
  .header-actions,
  .status-filters,
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .stat-card strong,
  .uptime-ring-core strong {
    font-size: 28px;
  }

  .auth-copy .page-title,
  .page-title {
    max-width: none;
  }
}
