:root {
  color-scheme: light;
  --bg: #f4f1e9;
  --bg-deep: #eae5d9;
  --surface: rgba(255, 255, 252, 0.82);
  --surface-solid: #fffefa;
  --surface-subtle: rgba(249, 247, 240, 0.76);
  --text: #1f2826;
  --muted: #6d7771;
  --faint: #909992;
  --line: rgba(43, 57, 52, 0.13);
  --line-strong: rgba(43, 57, 52, 0.22);
  --accent: #285e50;
  --accent-soft: #dce9e2;
  --operational: #2f7d55;
  --operational-soft: #dceee4;
  --degraded: #a36d14;
  --degraded-soft: #f5e9cb;
  --down: #b84c3f;
  --down-soft: #f3dfda;
  --unknown: #78817c;
  --unknown-soft: #e6e8e5;
  --disabled: #7a7469;
  --disabled-soft: #ebe7de;
  --shadow: 0 22px 64px rgba(54, 55, 45, 0.08);
  --radius-lg: 24px;
  --radius-md: 17px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101613;
    --bg-deep: #0b100e;
    --surface: rgba(27, 36, 32, 0.84);
    --surface-solid: #1a231f;
    --surface-subtle: rgba(23, 31, 28, 0.84);
    --text: #edf1ec;
    --muted: #a2aca5;
    --faint: #77817a;
    --line: rgba(225, 235, 228, 0.11);
    --line-strong: rgba(225, 235, 228, 0.2);
    --accent: #8dc6ad;
    --accent-soft: #203f34;
    --operational: #71c493;
    --operational-soft: #193a2b;
    --degraded: #e3b35b;
    --degraded-soft: #45351a;
    --down: #ee8174;
    --down-soft: #47251f;
    --unknown: #a7b0aa;
    --unknown-soft: #303734;
    --disabled: #aaa296;
    --disabled-soft: #35322d;
    --shadow: 0 24px 72px rgba(0, 0, 0, 0.24);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 9% 5%, color-mix(in srgb, var(--accent-soft) 68%, transparent) 0, transparent 27rem),
    radial-gradient(circle at 94% 12%, color-mix(in srgb, var(--degraded-soft) 45%, transparent) 0, transparent 23rem),
    linear-gradient(160deg, var(--bg), var(--bg-deep));
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 720;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 25px;
  height: 25px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.brand-mark i {
  display: block;
  height: 55%;
  border-radius: 2px;
  background: var(--accent);
}

.brand-mark i:nth-child(2) {
  height: 95%;
}

.brand-mark i:nth-child(3) {
  height: 72%;
}

.brand-env {
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.overall,
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.overall {
  color: var(--muted);
  font-size: 12px;
}

.state-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--unknown);
  box-shadow: 0 0 0 4px var(--unknown-soft);
}

.state-operational {
  background: var(--operational);
  box-shadow: 0 0 0 4px var(--operational-soft);
}

.state-degraded {
  background: var(--degraded);
  box-shadow: 0 0 0 4px var(--degraded-soft);
}

.state-down {
  background: var(--down);
  box-shadow: 0 0 0 4px var(--down-soft);
}

.state-disabled {
  background: var(--disabled);
  box-shadow: 0 0 0 4px var(--disabled-soft);
}

main {
  flex: 1;
  padding: 72px 0 56px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 58px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 14px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 730;
}

.lead {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
}

.refresh-block {
  min-width: 154px;
  display: grid;
  justify-items: end;
  gap: 8px;
  color: var(--faint);
  font-size: 11px;
}

.refresh-button {
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.refresh-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.refresh-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.notice {
  margin: -32px 0 38px;
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--down) 35%, var(--line));
  border-radius: 13px;
  color: var(--down);
  background: color-mix(in srgb, var(--down-soft) 72%, transparent);
}

section + section {
  margin-top: 54px;
}

.section-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.section-count {
  color: var(--faint);
  font-size: 11px;
}

.card-grid,
.management-grid,
.usage-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.card {
  grid-column: span 4;
  min-height: 214px;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: inherit;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset;
  text-decoration: none;
  backdrop-filter: blur(16px);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.management-card {
  grid-column: span 12;
  min-height: 176px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 28px 30px;
  background:
    linear-gradient(130deg, color-mix(in srgb, var(--accent-soft) 54%, var(--surface)), var(--surface));
}

.platform-grid .card:first-child {
  grid-column: span 8;
}

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

.card-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--accent);
  background: var(--surface-subtle);
}

.card-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.status {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.card h3 {
  margin: 24px 0 7px;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 24px 0 7px;
}

.card-title-row h3 {
  margin: 0;
}

.card-title-row a {
  text-decoration: none;
}

.card-title-row a:hover {
  color: var(--accent);
}

.collapsible-row {
  cursor: pointer;
}

.expand-button {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: 700 16px/1 ui-sans-serif, sans-serif;
  cursor: pointer;
}

.card-title-row h3 + .expand-button {
  margin-left: -3px;
}

.expand-button:hover,
.expand-button:focus-visible {
  color: var(--accent);
  outline: none;
}

.info-button {
  width: 20px;
  height: 20px;
  position: relative;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-subtle);
  font: 700 11px/1 ui-sans-serif, sans-serif;
  cursor: help;
}

.info-button:hover,
.info-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.info-button::after {
  width: min(290px, 70vw);
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(100% + 10px);
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  content: attr(data-tooltip);
  font: 500 11px/1.4 ui-sans-serif, sans-serif;
  text-align: left;
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.info-button:hover::after,
.info-button:focus-visible::after {
  transform: translate(-50%, 0);
  opacity: 1;
}

.card-description {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.card-footer {
  margin-top: auto;
}

.badge {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-arrow {
  color: var(--faint);
  font-size: 18px;
  text-decoration: none;
  transition: transform 160ms ease;
}

.card:hover .card-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

.components {
  margin: 17px -2px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.components[hidden] {
  display: none;
}

.component-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px 12px;
  margin-top: 12px;
}

.management-card .component-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.component {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.component .state-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.component-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.component-name {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

a.component-name::after {
  content: ' ↗';
  color: var(--accent);
}

a.component-name:hover,
a.component-name:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.component-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.component .info-button {
  width: 17px;
  height: 17px;
  font-size: 9px;
}

.component .info-button::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.component .info-button:hover::after,
.component .info-button:focus-visible::after {
  transform: translateY(0);
}

.help-dialog {
  width: min(620px, calc(100vw - 30px));
  max-height: min(720px, calc(100vh - 30px));
  padding: 30px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.28);
}

.help-dialog::backdrop {
  background: rgba(7, 13, 11, 0.5);
  backdrop-filter: blur(5px);
}

.help-dialog h2 {
  margin: 0 42px 14px 0;
  font-size: 27px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-subtle);
  font: 300 22px/1 sans-serif;
  cursor: pointer;
}

.dialog-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.help-summary {
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 650;
}

.help-details {
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
}

.help-meta {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}

.usage-card {
  grid-column: span 6;
  min-height: 190px;
}

.usage-card h3 {
  margin-top: 19px;
}

.quota-window {
  margin-top: 13px;
}

.quota-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.quota-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.quota-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--operational);
}

.quota-track i.warn {
  background: var(--degraded);
}

.quota-track i.danger {
  background: var(--down);
}

footer {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--line), var(--surface-subtle), var(--line));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-label {
  width: 80px;
  height: 12px;
}

.skeleton-title {
  width: 55%;
  height: 22px;
  margin-top: 48px;
}

.skeleton-line {
  width: 90%;
  height: 10px;
  margin-top: 14px;
}

.skeleton-line.short {
  width: 65%;
  margin-top: 8px;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@media (max-width: 900px) {
  .card,
  .platform-grid .card:first-child {
    grid-column: span 6;
  }

  .management-card {
    grid-column: span 12;
  }

  .management-card .component-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 26px, 1180px);
  }

  .topbar {
    min-height: 64px;
  }

  .overall span:last-child {
    display: none;
  }

  main {
    padding-top: 46px;
  }

  .hero {
    display: block;
    margin-bottom: 44px;
  }

  .refresh-block {
    margin-top: 24px;
    justify-items: start;
  }

  .card,
  .management-card,
  .platform-grid .card:first-child,
  .usage-card {
    grid-column: span 12;
  }

  .management-card {
    display: flex;
    align-items: stretch;
    padding: 22px;
  }

  .management-card .component-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-heading {
    align-items: start;
  }

  .section-count {
    max-width: 140px;
    text-align: right;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
  }

  .info-button::after {
    display: none;
  }
}

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