/* Appwrite status page, in the console's design language (appwrite/vibes
   src/styles.css and AGENTS.md): Inter, 13-15px type, rounded-xl bordered
   cards with separators, tinted status badges, pink primary actions. Dark by
   default like the console; light when the system asks for it. */

/* Inter weights match appwrite/vibes src/fonts-inter-latin.css (400 + 600). */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/inter-latin-400-normal.0364d368ab.woff2') format('woff2'); }
@font-face { font-family: 'Aeonik Pro'; font-weight: 400; font-display: swap; src: url('fonts/AeonikPro-Regular.4545036e3b.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/inter-latin-600-normal.048d136d59.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --background: #19191c;
  --card: #1d1d21;
  --surface: #1b1b1e; /* vibes' bg-card/50 over the background */
  --muted: #2d2d31;
  --border: oklch(0.252 0.005 286.32);
  --foreground: oklch(0.985 0 0);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --primary: #fd366e;
  --primary-hover: #e32e62;

  --green: oklch(0.792 0.209 151.711);   /* green-400 */
  --green-bar: oklch(0.723 0.219 149.579 / 0.85);
  --amber: oklch(0.828 0.189 84.429);    /* amber-400 */
  --red: oklch(0.704 0.191 22.216);      /* red-400 */
  --blue: oklch(0.707 0.165 254.624);    /* blue-400 */
  --empty: #2d2d31;

  --radius: 0.625rem;
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Network globe region markers (vibes src/styles.css). */
  --network-globe-region: #fe9567;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --background: oklch(0.985 0 0);
    --card: oklch(1 0 0);
    --surface: #ffffff;
    --muted: oklch(0.967 0.001 286.375);
    --border: oklch(0.93 0.0035 286.32);
    --foreground: oklch(0.141 0.005 285.823);
    --muted-foreground: oklch(0.552 0.016 285.938);
    --green: oklch(0.627 0.194 149.214);  /* green-600 */
    --green-bar: oklch(0.723 0.219 149.579);
    --amber: oklch(0.666 0.179 58.318);   /* amber-600 */
    --red: oklch(0.577 0.245 27.325);     /* red-600 */
    --blue: oklch(0.546 0.245 262.881);   /* blue-600 */
    --empty: oklch(0.92 0.004 286.32);
    --network-globe-region: #ffb088;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
body {
  margin: 0; min-height: 100svh;
  background: var(--background); color: var(--foreground);
  font: 400 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted-foreground); }

.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Top bar */
.topbar { border-bottom: 1px solid var(--border); background: var(--background); position: sticky; top: 0; z-index: 10; }
/* Brand, tabs and action in three columns, so the tabs sit in the true centre. */
.topbar-inner {
  max-width: 832px; margin: 0 auto; padding: 0 16px; height: 64px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
}
.topbar-inner > .button { justify-self: end; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 15px; font-weight: 600; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  text-decoration: none; color: var(--muted-foreground); font-weight: 500;
  padding: 6px 10px; border-radius: 8px; transition: color 0.2s, background 0.2s;
}
.topbar nav a:hover { color: var(--foreground); background: var(--muted); }
.topbar nav a[aria-current="page"] { color: var(--foreground); background: var(--muted); }

.button {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--muted); color: var(--foreground); font: 600 13px var(--font); cursor: pointer;
  transition: background 0.2s;
}
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-hover); }
.icon-button {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--muted-foreground); cursor: pointer;
}
.icon-button:hover { color: var(--foreground); background: var(--muted); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }

.stale {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: color-mix(in srgb, var(--amber) 12%, var(--background)); color: var(--amber);
  padding: 10px 16px; font-weight: 500;
}

main { max-width: 832px; margin: 0 auto; padding: 32px 16px 48px; display: flex; flex-direction: column; gap: 12px; }

/* Cards: the console's settings card (rounded-xl border bg-card/50). */
.card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.card-compact .card-head { border-bottom: 0; }
.services { display: flex; flex-direction: column; gap: 12px; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.25; }

.group {
  margin-top: 20px; padding: 0 4px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-foreground);
}
.hero + .notice {
  margin-top: 0;
}
.hero + .group {
  position: relative; z-index: 3; margin-top: 16px;
}

/* Overview hero, after the network section on appwrite.io */
.hero {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding: 24px 0 4px; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-copy {
  display: flex; flex-direction: column; align-items: center; gap: 24px; max-width: 640px;
  padding: 0 16px; margin-bottom: 0; position: relative; z-index: 2;
}
.hero h1 {
  font-family: 'Aeonik Pro', var(--font); font-weight: 400; font-size: clamp(32px, 6vw, 44px);
  line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance;
}
.cursor { color: var(--primary); margin-left: 0.08em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-copy > p { font-size: 14px; line-height: 1.5; color: var(--muted-foreground); max-width: 540px; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.facts li { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; line-height: 1.25; }
.facts .icon { color: var(--tone); }
/* Split-flap incident counter: one upper page turns onto each fixed lower half. */
.incident-streak { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.incident-streak h2 { font-size: 14px; font-weight: 600; }
.incident-streak p { font-size: 12px; color: var(--muted-foreground); }
.flip-counter { display: flex; gap: 10px; }
.flip-digit {
  position: relative; perspective: 600px; display: grid; place-items: center; width: clamp(58px, 10vw, 84px); height: clamp(80px, 14vw, 112px);
  border-radius: 8px; background: #242429; color: #fafafa;
  box-shadow: 0 4px 0 #111114, 0 8px 16px rgb(0 0 0 / 0.2);
  font: 600 clamp(56px, 9vw, 84px)/1 var(--font); font-variant-numeric: tabular-nums;
}
.flip-digit::before {
  content: attr(data-digit); position: absolute; inset: 0; display: grid; place-items: center;
  border-radius: inherit; background: linear-gradient(#36363d, #29292f);
  clip-path: inset(0 0 50%); transform-origin: center; animation: flip-page 650ms ease-out backwards;
}
.flip-digit::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #111114; box-shadow: 0 1px rgb(255 255 255 / 0.05); }
.flip-digit:nth-child(2)::before { animation-delay: 90ms; }
.flip-digit:nth-child(3)::before { animation-delay: 180ms; }
@keyframes flip-page { from { transform: rotateX(-90deg); } to { transform: rotateX(0); } }
@media (prefers-reduced-motion: reduce) { .flip-digit::before { animation: none; } }

/* Frame matches appwrite/vibes NetworkGlobeMount. */
.globe-mount {
  position: relative; z-index: 1; align-self: stretch; width: 100%; max-width: min(100%, 44rem);
  margin: -16px auto 0; aspect-ratio: 100 / 48; overflow: hidden; isolation: isolate;
}
@media (min-width: 640px) {
  .globe-mount { margin-top: -28px; max-width: min(100%, 52rem); }
}
@media (min-width: 1024px) {
  .globe-mount { margin-top: -36px; max-width: min(100%, 60rem); }
}
.globe-square {
  position: absolute; left: 0; right: 0; top: -6%; width: 100%; aspect-ratio: 1;
  pointer-events: none;
}
.globe-backdrop {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--foreground) 5%, transparent) 0%, transparent 68%);
}
.globe {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
}
.globe canvas { display: block; width: 100%; height: 100%; pointer-events: none; touch-action: pan-y; }
/* Soft edge before the hero rule; matches NetworkSection bottom fade on appwrite.io. */
.globe-fade {
  position: absolute; inset: auto 0 0 0; z-index: 2; height: 8rem; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--background));
}
@media (min-width: 640px) {
  .globe-fade { height: 10rem; }
}
@media (min-width: 1024px) {
  .globe-fade { height: 12rem; }
}
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
  color: var(--amber); background: color-mix(in srgb, var(--amber) 8%, var(--background));
  border: 1px solid color-mix(in srgb, var(--amber) 24%, var(--border));
}
.notice .icon { margin-top: 2px; }

/* History range selection and daily bars. */
.history-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-range span { margin-right: auto; color: var(--muted-foreground); }
.history-range a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; }
.history-range a[aria-current] { background: var(--muted); color: var(--foreground); }
.components { list-style: none; margin: 0; padding: 0; }
.component { padding: 14px 24px; }
.component + .component { border-top: 1px solid var(--border); }
.component-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.component-head .name {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; line-height: 1.25; margin-right: auto;
}
.component-hint {
  display: grid; place-items: center; width: 18px; height: 18px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted-foreground); cursor: help;
}
.component-hint .icon { width: 14px; height: 14px; }
.component-hint:hover, .component-hint:focus-visible { color: var(--foreground); background: var(--muted); outline: none; }
.uptime { font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; height: 24px; }
.bars li { flex: 1; border-radius: 2px; background: var(--bar); transition: opacity 0.15s; }
.bars li:hover, .bars li:focus-visible { opacity: 0.65; outline: none; }

.tooltip {
  position: fixed; z-index: 20; pointer-events: none; min-width: 180px; max-width: 260px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--foreground); box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
  display: flex; flex-direction: column; gap: 2px; font-size: 12px;
}
.tooltip-date { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.tooltip-status { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--tone); }
.tooltip-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bar); }
.tooltip-detail { color: var(--muted-foreground); }
.tooltip-incident { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); font-weight: 500; }
.tooltip-incident + .tooltip-incident { margin-top: 0; padding-top: 2px; border-top: 0; }
.scale { display: flex; justify-content: space-between; padding: 0 24px 14px; font-size: 11px; color: var(--muted-foreground); }

.regions .region + .region { border-top: 1px solid var(--border); }
.region {
  /* Align nested monitors with the region title and summary badge column. */
  --region-pad-x: 24px;
  --region-nest-inset: calc(var(--region-pad-x) + 24px + 12px); /* pad, flag, gap */
  --region-badge-trail: calc(12px + 16px); /* gap before chevron, chevron */
}
.region > summary { display: flex; align-items: center; gap: 12px; padding: 14px var(--region-pad-x); cursor: pointer; list-style: none; }
.region > summary::-webkit-details-marker { display: none; }
.region > summary:hover { background: color-mix(in srgb, var(--muted) 40%, transparent); }
.region-identity {
  display: flex; align-items: center; gap: 12px;
  margin-right: auto; min-width: 0;
}
.flag {
  display: block; width: 24px; height: 24px; flex: none; object-fit: cover;
  border-radius: 8px; border: 1px solid color-mix(in srgb, var(--border) 50%, transparent); background: var(--background);
}
.region-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.region-name { font-size: 13px; font-weight: 500; line-height: 1.25; }
.region-sub { font-size: 12px; line-height: 1.25; color: var(--muted-foreground); }
.bars.mini { width: 180px; height: 18px; gap: 2px; flex: none; }
.bars.mini li { border-radius: 1.5px; }
.region .uptime { width: 56px; text-align: right; }
.chevron { display: grid; color: var(--muted-foreground); transition: transform 0.2s; }
.region[open] .chevron { transform: rotate(90deg); }
.region[open] > summary { border-bottom: 1px solid var(--border); }
.region-body .component {
  padding: 12px var(--region-pad-x) 12px var(--region-nest-inset);
}
.region-body .component-head { margin-bottom: 0; }
.region-body .component-head:has(+ .bars) { margin-bottom: 10px; }
.region-body .component-head .badge { margin-right: var(--region-badge-trail); }
.region-body .scale { padding-left: var(--region-nest-inset); padding-right: var(--region-pad-x); }

/* Badges: vibes status variants + text-[10px] in tight rows (AGENTS.md). */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: fit-content; white-space: nowrap;
  font-size: 10px; font-weight: 500; line-height: 1.25; padding: 4px 10px; border-radius: 6px;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 10%, transparent);
}
.hero-copy .badge { font-size: 12px; line-height: 1.333; padding: 5px 11px; }
.badge.state-not_monitored {
  color: var(--muted-foreground); background: var(--muted);
}

.state-operational { --tone: var(--green); --bar: var(--green-bar); }
.state-degraded { --tone: var(--amber); --bar: var(--amber); }
.state-downtime { --tone: var(--red); --bar: var(--red); }
.state-maintenance, .state-scheduled { --tone: var(--blue); --bar: var(--blue); }
.state-not_monitored { --tone: var(--muted-foreground); --bar: var(--empty); }
.state-resolved { --tone: var(--green); --bar: var(--empty); }

/* Incidents: one card each, a timeline of updates inside. */
.incident { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.incident-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.incident h3 { font-size: 14px; font-weight: 600; line-height: 1.25; }
.meta { color: var(--muted-foreground); font-size: 12px; margin-top: 3px; }
.meta .sep { margin: 0 6px; }

.affected { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.affected li {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px 0 10px;
  border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 500;
}
.affected li:not(:has(.flags, .all-regions)) { padding-right: 10px; }
.flags { display: inline-flex; }
.flags img {
  width: 16px; height: 16px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 2px var(--surface);
}
.flags img + img { margin-left: -4px; }
.all-regions { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); }

.updates { list-style: none; margin: 0; padding: 0; }
.update { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.update:last-child { padding-bottom: 0; }
/* The line joining one update's dot to the next. */
.update:not(:last-child)::after {
  content: ''; position: absolute; left: 7px; top: 20px; bottom: 2px; width: 2px; background: var(--border);
}
.update-dot {
  flex: none; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone) 18%, transparent); box-shadow: inset 0 0 0 1.5px var(--tone); color: var(--tone);
}
.update-dot .icon { width: 10px; height: 10px; stroke-width: 3; }
.update-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.update-head { display: flex; align-items: baseline; gap: 8px; }
.update-status { font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--tone); }
.update-head time { font-size: 12px; color: var(--muted-foreground); }
.update-body p { color: color-mix(in srgb, var(--foreground) 85%, transparent); overflow-wrap: anywhere; }
.update-body a { color: var(--foreground); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.update-body a:hover { text-decoration-color: var(--primary); }
.update-body code {
  font: 12px ui-monospace, 'Fira Code', monospace; padding: 1px 5px; border-radius: 5px;
  background: var(--muted); border: 1px solid var(--border);
}

.earlier > summary {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none;
  color: var(--muted-foreground); font-size: 12px; font-weight: 500;
}
.earlier > summary::-webkit-details-marker { display: none; }
.earlier > summary .icon { width: 14px; height: 14px; transition: transform 0.2s; }
.earlier[open] > summary .icon { transform: rotate(90deg); }
.earlier > summary:hover { color: var(--foreground); }
.earlier[open] > summary { margin-bottom: 12px; }

.more { display: flex; align-items: center; gap: 6px; width: fit-content; margin: 8px 4px 0; color: var(--muted-foreground); text-decoration: none; font-weight: 500; }
.more:hover { color: var(--foreground); }

/* Incident and maintenance history: month labels over plain cards. */
.page-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.page-head p { color: var(--muted-foreground); }
.month { display: flex; flex-direction: column; gap: 12px; }
.empty {
  display: flex; align-items: center; gap: 8px; padding: 14px 20px; color: var(--muted-foreground);
  border: 1px dashed var(--border); border-radius: 12px;
}

/* Get updates dialog */
dialog {
  width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--foreground); box-shadow: 0 24px 64px rgb(0 0 0 / 0.4);
}
dialog::backdrop { background: rgb(0 0 0 / 0.6); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 14px; font-weight: 600; line-height: 1.25; }
.dialog-head p { margin-top: 4px; }
.tabs { display: flex; margin: 16px 24px 0; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 8px; width: fit-content; }
.tabs button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; color: var(--muted-foreground); font: 500 13px var(--font);
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.tabs .icon { width: 14px; height: 14px; flex: none; }
.tabs button[data-tab="slack"] .icon { fill: currentColor; stroke: none; }
.tabs button:not([aria-selected="true"]) .icon { opacity: 0.8; }
.tabs button[aria-selected="true"] { background: var(--muted); color: var(--foreground); }
.tab-panels {
  display: grid; padding: 16px 24px 24px;
}
.tab-panels > .tab-panel {
  grid-area: 1 / 1; display: flex; flex-direction: column; gap: 12px;
  color: var(--muted-foreground); visibility: hidden; pointer-events: none;
}
.tab-panels > .tab-panel.is-active { visibility: visible; pointer-events: auto; }
.copy-field { display: flex; gap: 8px; }
.copy-field input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--background); color: var(--foreground); font: 400 12px ui-monospace, 'Fira Code', monospace;
}
.copy-field .icon-button { width: 36px; height: 36px; }
[data-copy] .icon:last-child, [data-copy].copied .icon:first-child { display: none; }
[data-copy].copied .icon:last-child { display: block; color: var(--green); }

footer { max-width: 832px; margin: 0 auto; padding: 8px 16px 40px; display: flex; gap: 20px; align-items: center; justify-content: center; font-size: 12px; color: var(--muted-foreground); }
footer a { text-decoration: none; }
footer a:hover { color: var(--foreground); }
footer .footer-link { display: inline-flex; align-items: center; gap: 6px; }
footer .footer-link .icon { width: 16px; height: 16px; flex: none; fill: currentColor; stroke: none; }

@media (max-width: 640px) {
  .topbar-inner { gap: 8px; }
  .topbar nav a:first-child, .brand span { display: none; }
  .bars:not(.mini) { gap: 1px; }
  .bars.mini, .region .uptime { display: none; }
  .component, .region > summary, .card-head, .incident { padding-left: 16px; padding-right: 16px; }
  .region { --region-pad-x: 16px; }
  .region-body .component { padding-left: var(--region-nest-inset); padding-right: var(--region-pad-x); }
  .scale { padding: 0 16px 14px; }
}
