:root {
  color-scheme: light dark;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --text: #16171a;
  --muted: #5d6068;
  --line: #dddbd3;
  --ok: #1f7a4d;
  --warn: #9a6a00;
  --down: #c2362b;
  --accent: #16171a;
  --accent-text: #ffffff;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1b1e;
    --text: #ececea;
    --muted: #9a9ca3;
    --line: #2b2d31;
    --ok: #4cc38a;
    --warn: #e5b54a;
    --down: #ff6b5e;
    --accent: #ececea;
    --accent-text: #111214;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

[hidden] {
  display: none !important;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bar-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}

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

.icon-button[aria-busy="true"] svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .icon-button[aria-busy="true"] svg {
    animation: none;
    opacity: 0.5;
  }
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.summary strong {
  display: block;
  font-size: 17px;
}

.summary span {
  color: var(--muted);
  font-size: 14px;
}

.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0 20px;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.links a.primary {
  grid-column: 1 / -1;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.links a::after {
  content: "↗";
  font-weight: 400;
  opacity: 0.7;
}

.group {
  margin: 0 0 20px;
}

.group h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.row:first-child {
  border-top: 0;
}

.row-name {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: break-word;
}

.row-detail {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: break-word;
}

/* Status is carried by the label text and the mark's shape, not only colour. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.04em;
}

.badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.badge.ok {
  color: var(--ok);
}

.badge.warn {
  color: var(--warn);
}

.badge.warn::before {
  border-radius: 2px;
}

.badge.down {
  color: var(--down);
}

.badge.down::before {
  border-radius: 0;
  transform: rotate(45deg);
}

.summary .badge {
  min-width: 0;
}

.summary .badge::before {
  width: 14px;
  height: 14px;
}

.login {
  max-width: 360px;
  margin: 12vh auto 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.login h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

button {
  font: inherit;
  cursor: pointer;
}

button.primary {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.form-error {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--down);
  font-size: 14px;
}

.foot {
  display: flex;
  justify-content: center;
  padding: 8px 0 24px;
}

.text-button {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
}
