* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(248, 250, 252, 0.72);
  --ink: #15171a;
  --muted: #667085;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.16);
  --primary: #111315;
  --primary-strong: #000000;
  --google-blue: #4285f4;
  --google-red: #ea4335;
  --google-yellow: #fbbc04;
  --google-green: #34a853;
  --success: #188038;
  --warning: #b06000;
  --danger: #d93025;
  --cyan: #1a73e8;
  --terminal: #0d1117;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.09);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.055);
  --blur: blur(18px) saturate(140%);
}

@property --shine-x {
  syntax: "<percentage>";
  inherits: false;
  initial-value: -20%;
}

html {
  background: #fff;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(66, 133, 244, 0.08), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #fbfcff 58%, #f6f8fb 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(66, 133, 244, 0.55) 0 1px, transparent 1.3px) 4px 6px / 42px 38px,
    radial-gradient(circle, rgba(66, 133, 244, 0.22) 0 1px, transparent 1.4px) 22px 18px / 64px 54px;
  animation: particle-drift 32s linear infinite;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.52), transparent 54%);
}

button,
input,
textarea {
  font: inherit;
}

.page {
  position: relative;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px 28px 56px;
}

.page::before {
  content: "";
  position: fixed;
  top: 92px;
  right: 9vw;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 32%, rgba(66, 133, 244, 0.16), transparent 34%),
    radial-gradient(circle at 68% 62%, rgba(52, 168, 83, 0.1), transparent 38%);
  filter: blur(10px);
  opacity: 0.9;
  pointer-events: none;
  animation: ambient-orbit 18s ease-in-out infinite alternate;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: center;
  margin-bottom: 34px;
  animation: rise-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(145deg, #17191c 0%, #050505 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: 0 13px 32px rgba(0, 0, 0, 0.2);
  transform: translateZ(0);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.brand-mark:hover {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px) scale(1.03);
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: #1a73e8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 38px;
  line-height: 1.04;
  font-weight: 780;
}

h2 {
  font-size: 18px;
  font-weight: 800;
}

.subtitle {
  margin: 8px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  backdrop-filter: var(--blur);
  animation: fade-in 360ms 80ms ease both;
}

.topbar-actions button {
  width: auto;
  min-width: 104px;
  min-height: 38px;
  padding-right: 18px;
  padding-left: 18px;
  border-radius: 999px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 13%, transparent);
}

.status-pill[data-state="online"] {
  color: var(--success);
}

.status-pill[data-state="online"]::before {
  animation: status-pulse 1800ms ease-out infinite;
}

.status-pill[data-state="offline"] {
  color: var(--danger);
}

.status-pill[data-state="warning"] {
  color: var(--warning);
}

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

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-column {
  display: grid;
  gap: 18px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}

.metric-card:hover,
.panel:hover {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.metric-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  animation: rise-in 440ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.metric-card-primary {
  grid-column: span 2;
  min-height: 156px;
  padding: 26px;
}

.metric-card-primary strong {
  max-width: calc(100% - 80px);
  font-size: 34px;
}

.metric-card-primary::after {
  width: 68px;
  height: 68px;
  border-radius: 24px;
}

.metric-card:nth-child(1) {
  animation-delay: 30ms;
}

.metric-card:nth-child(2) {
  animation-delay: 60ms;
}

.metric-card:nth-child(3) {
  animation-delay: 90ms;
}

.metric-card:nth-child(4) {
  animation-delay: 120ms;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(66, 133, 244, 0.18), rgba(52, 168, 83, 0.08)),
    #f1f6ff;
  transform: translateZ(0);
  animation: soft-float 6s ease-in-out infinite;
}

.metric-label,
.info-item span,
.muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.metric-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 10px;
  overflow: hidden;
  color: var(--ink);
  font-size: 23px;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.main-column,
.side-column {
  display: grid;
  gap: 18px;
}

.main-column .panel,
.side-column .panel {
  animation: rise-in 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.main-column .panel:nth-child(1) {
  animation-delay: 80ms;
}

.main-column .panel:nth-child(2) {
  animation-delay: 120ms;
}

.main-column .panel:nth-child(3) {
  animation-delay: 160ms;
}

.side-column .panel:nth-child(1) {
  animation-delay: 100ms;
}

.side-column .panel:nth-child(2) {
  animation-delay: 150ms;
}

.panel {
  padding: 22px;
}

.status-panel {
  align-self: stretch;
}

.settings-panel {
  height: 100%;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

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

.info-item,
.stat-tile,
.latest-box,
.compact-list-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.info-item:hover,
.stat-tile:hover,
.latest-box:hover,
.compact-list-item:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.86);
  transform: translateY(-1px);
}

.info-item {
  min-width: 0;
  padding: 15px;
}

.info-item strong {
  display: block;
  margin-top: 9px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

label {
  display: block;
  margin: 13px 0 7px;
  color: #2f3a4d;
  font-size: 13px;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(129, 140, 165, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:focus,
textarea:focus {
  border-color: rgba(11, 99, 246, 0.78);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(11, 99, 246, 0.13);
}

textarea {
  border-radius: 18px;
  min-height: 106px;
  resize: vertical;
}

button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #111315;
  color: #fff;
  cursor: pointer;
  font-weight: 760;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
  transition: box-shadow 140ms ease, filter 140ms ease, transform 140ms ease;
  position: relative;
  overflow: hidden;
}

button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, transparent var(--shine-x), rgba(255, 255, 255, 0.2) calc(var(--shine-x) + 12%), transparent calc(var(--shine-x) + 24%));
  opacity: 0;
  transition: opacity 160ms ease;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
  animation: button-shine 900ms ease;
}

button:hover::after {
  opacity: 1;
}

button:active {
  transform: translateY(0) scale(0.985);
}

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

button.secondary {
  background: rgba(248, 250, 252, 0.92);
  color: #182235;
  box-shadow: inset 0 0 0 1px var(--line);
}

button.secondary:hover {
  box-shadow: inset 0 0 0 1px rgba(129, 140, 165, 0.28);
}

button.danger {
  background: #ea4335;
  box-shadow: 0 10px 22px rgba(217, 48, 37, 0.18);
}

button.danger:hover {
  box-shadow: 0 14px 28px rgba(217, 48, 37, 0.22);
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.status-line {
  margin: 12px 0 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.status-line[data-kind="pending"] {
  color: var(--primary);
}

.status-line[data-kind="success"] {
  color: var(--success);
}

.status-line[data-kind="error"] {
  color: var(--danger);
}

.terminal {
  margin: 12px 0 0;
  max-height: 420px;
  min-height: 148px;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, #111827 0%, var(--terminal) 100%);
  color: #dbeafe;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal.compact {
  max-height: 260px;
  min-height: 112px;
}

details {
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
}

details:first-of-type {
  border-top: 0;
  padding-top: 0;
}

details + details {
  margin-top: 13px;
}

summary {
  cursor: pointer;
  color: #2f3a4d;
  font-size: 13px;
  font-weight: 800;
}

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

.stat-tile {
  min-width: 0;
  padding: 16px;
}

.stat-tile span,
.latest-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat-tile strong {
  display: block;
  margin-top: 9px;
  overflow: hidden;
  font-size: 30px;
  font-weight: 760;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.compact-list-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px;
}

.compact-list-item strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-list-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.debug-meter {
  display: grid;
  gap: 13px;
  margin-top: 17px;
}

.debug-meter-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 36px;
  gap: 11px;
  align-items: center;
}

.debug-meter-row span,
.debug-meter-row strong {
  color: #2f3a4d;
  font-size: 13px;
  font-weight: 800;
}

.debug-meter-row div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.82);
}

.debug-meter-row i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4285f4, #1a73e8);
  transition: width 720ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.debug-meter-row:nth-child(2) i {
  background: linear-gradient(90deg, #34a853, #fbbc04);
}

.latest-box {
  margin-top: 17px;
  padding: 15px;
}

.latest-box strong {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest-box small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1080px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

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

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

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

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

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

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

  .topbar-actions {
    border-radius: 22px;
  }

  .brand {
    gap: 13px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  h1 {
    font-size: 32px;
  }

  .summary-grid,
  .info-grid,
  .stat-grid,
  .compact-list-item {
    grid-template-columns: 1fr;
  }

  .metric-card-primary {
    grid-column: span 1;
    min-height: 0;
    padding: 20px;
  }

  .metric-card-primary strong {
    max-width: calc(100% - 64px);
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@keyframes particle-drift {
  from {
    background-position: 4px 6px, 22px 18px;
  }
  to {
    background-position: 46px 44px, -42px 72px;
  }
}

@keyframes ambient-orbit {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.65;
  }
  100% {
    transform: translate3d(-34px, 26px, 0) scale(1.08);
    opacity: 0.95;
  }
}

@keyframes rise-in {
  from {
    opacity: 0.72;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes soft-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-4px, -6px, 0);
  }
}

@keyframes status-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(24, 128, 56, 0.24);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(24, 128, 56, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(24, 128, 56, 0);
  }
}

@keyframes button-shine {
  from {
    --shine-x: -20%;
  }
  to {
    --shine-x: 110%;
  }
}
