:root {
  --bg: #f5f7f8;
  --bg-accent: #e8eef2;
  --surface: #ffffff;
  --text: #1a2330;
  --text-muted: #5b6b7c;
  --text-subtle: #7a8a9a;
  --border: #d5dde5;
  --available: #34c759;
  --degraded: #ffcc00;
  --outage: #ff3b30;
  --brand: #0b6e6e;
  --brand-ink: #084f4f;
  --shadow: 0 1px 2px rgba(26, 35, 48, 0.06);
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9ecec 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e7eef8 0%, transparent 50%),
    var(--bg);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.brand-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.brand {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--brand-ink);
  margin: 0;
}

.brand span {
  font-weight: 500;
  color: var(--text-muted);
}

.updated {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.headline {
  margin: 0 0 1.75rem;
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.headline[data-severity="available"] {
  color: #1f7a3a;
}

.headline[data-severity="degraded"] {
  color: #8a6a00;
}

.headline[data-severity="outage"] {
  color: #b42318;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin: 0 0 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.dot-available {
  background: var(--available);
}

.dot-degraded {
  background: var(--degraded);
}

.dot-outage {
  background: var(--outage);
}

.groups {
  display: grid;
  gap: 1.5rem;
}

.group h2 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 1.5rem;
}

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

.service {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.35rem;
  border-radius: 0.4rem;
  cursor: default;
}

.service:hover,
.service:focus-within {
  background: rgba(255, 255, 255, 0.7);
}

.service-name {
  font-size: 0.9375rem;
  color: var(--text);
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.service.has-issue {
  cursor: help;
}

.tooltip {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% - 0.15rem);
  padding: 0.85rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  box-shadow: 0 10px 30px rgba(26, 35, 48, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.25rem);
  transition: opacity 120ms ease, transform 120ms ease;
}

.service:hover .tooltip,
.service:focus-within .tooltip,
.service[data-open="true"] .tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.tooltip h3 {
  margin: 0 0 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.tooltip p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.tooltip .meta {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.resolved {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.resolved h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.resolved-item {
  margin-bottom: 1.1rem;
}

.resolved-item h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
}

.resolved-item p {
  margin: 0.2rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.footer-note {
  margin-top: 2.5rem;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

/* Admin */
.admin-shell {
  width: min(820px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.admin-shell h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.admin-shell .lede {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}

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

input,
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--text);
  margin-bottom: 0.85rem;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

button,
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 0.5rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

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

button.danger {
  background: #fff5f4;
  border-color: #f3b0ab;
  color: #9b1c1c;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.message {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #fbfdff;
}

.message.outage {
  border-color: #f3b0ab;
  background: #fff8f7;
}

.message.degraded {
  border-color: #f0d56a;
  background: #fffced;
}

.message.resolved {
  opacity: 0.85;
}

.message-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}

.message-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.message-header .badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.message p {
  margin: 0.2rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.status-banner {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.error {
  color: #9b1c1c;
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

.token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.token-row label {
  grid-column: 1 / -1;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin: -0.5rem 0 0.85rem;
}
