/* Tokens mirror packages/ui/src/styles.css (brand extracted from shiftr.pro).
   Brand fonts are licensed for in-app use only, so this public page uses the
   system stack. Light theme only. */
:root {
  --background: #ffffff;
  --surface: #fafafa;
  --surface-hover: #f2f2f2;
  --surface-warm: #fbebe3;
  --border: #ededed;
  --foreground: #050505;
  --foreground-2: #1d1d1d;
  --muted: #7e7e7e;
  --accent-soft: #fbe96b;
  --accent: #ffdd2d;
  --accent-strong: #cfbd00;
  --accent-orange: #ff7300;
  --destructive: #ff3b30;
  --success: #3fbf5a;
  --success-soft: rgba(164, 255, 18, 0.15);
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 40px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  padding: 0 20px 48px;
}

a { color: inherit; }
a:focus-visible, .day:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: var(--foreground); padding: 8px 16px; border-radius: var(--radius-xl);
}
.skip:focus { left: 8px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.site-header, main, .site-footer { max-width: 860px; margin: 0 auto; }
.site-header { padding: 40px 0 24px; }

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; font-weight: 700; color: var(--foreground-2); letter-spacing: -0.01em;
}
/* Same wordmark + mark as the Suite header: display face at 20px, mark at 24px. */
.brand-name { font-family: "Gooper", Georgia, serif; font-weight: 500; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand-logo { width: 24px; height: 24px; flex-shrink: 0; }

/* Brand display face (same as the apps' headlines), licensed for Shift+R use. */
@font-face {
  font-family: "Gooper";
  src: url("fonts/Gooper7-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
h1 { font-family: "Gooper", Georgia, serif; font-weight: 500; font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.1; letter-spacing: -0.04em; margin: 16px 0 8px; }
h2 { font-size: 1.25rem; margin: 0 0 12px; letter-spacing: -0.01em; }
.lead { color: var(--muted); margin: 0; max-width: 60ch; }

/* --- overall banner --- */
.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 20px 24px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 24px;
}
.banner-main { display: flex; align-items: center; gap: 14px; }
.banner-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.banner--operational { background: var(--success-soft); border-color: transparent; }
.banner--degraded { background: var(--surface-warm); border-color: transparent; }
.banner--outage { background: var(--surface-warm); border-color: var(--destructive); }
.updated { color: var(--muted); font-size: 0.9375rem; }

/* --- status dots (always paired with text) --- */
.dot {
  width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block;
  background: var(--border);
}
.dot--lg { width: 18px; height: 18px; }
.dot--up, .dot--operational { background: var(--success); }
.dot--degraded, .dot--partial, .dot--maintenance { background: var(--accent-orange); }
.dot--down, .dot--outage { background: var(--destructive); }
.dot--unknown, .dot--none { background: var(--border); box-shadow: inset 0 0 0 2px var(--muted); }
.banner--loading .dot { background: var(--accent-soft); }

/* --- tabs: Shift+R and one per external provider --- */
.tabs {
  display: flex; gap: 4px; margin: 0 0 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0; margin: 0 0 -1px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 2px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font: inherit; font-weight: 600; font-size: 0.9375rem; color: var(--muted); white-space: nowrap;
}
.tab:hover { color: var(--foreground-2); background: var(--surface-hover); }
.tab[aria-selected="true"] { color: var(--foreground); border-bottom-color: var(--foreground); }
.tab:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
/* the dot that says "this one is not fully operational", visible from any tab */
.tab-badge { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.tab-badge--degraded { background: var(--accent-orange); }
.tab-badge--down { background: var(--destructive); }
.panel:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-sm); }

/* --- provider panels (Circle, Resend): banner + issues + component list --- */
.banner-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.btn--sm { padding: 6px 12px; font-size: 0.875rem; }
.btn--sm .btn-icon { width: 16px; height: 16px; }
.panel-title { font-size: 1rem; margin: 0 0 10px; color: var(--foreground-2); }
.issues { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.issue {
  display: grid; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 18px;
}
.issue--open { border-color: var(--destructive); background: var(--surface-warm); }
.issue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.issue-title { font-weight: 600; }
.issue-meta { color: var(--muted); font-size: 0.9375rem; }
.issue-update { margin: 0; font-size: 0.9375rem; color: var(--foreground-2); white-space: pre-line; }
.badge--impact-minor, .badge--impact-maintenance { background: var(--accent-soft); color: var(--foreground); }
.badge--impact-major, .badge--impact-critical { background: var(--destructive); color: var(--background); }
.provider-groups { display: grid; gap: 16px; margin-bottom: 40px; }
.provider-group {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 24px 12px;
}
.provider-group-name { margin: 0 0 6px; font-size: 1.125rem; letter-spacing: -0.01em; }
.provider-list { list-style: none; margin: 0; padding: 0; }
.provider-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border);
}
.provider-item:first-child { border-top: 0; }
.provider-item-name { font-weight: 600; font-size: 0.9375rem; flex: 1 1 auto; min-width: 0; }
.provider-item-state { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.provider-item--unknown .provider-item-name { color: var(--muted); }
.panel > .empty { margin: 0 0 24px; }

/* --- notices --- */
.notice {
  margin: 0 0 24px; padding: 14px 18px; border-radius: var(--radius-md);
  background: var(--surface-warm); color: var(--foreground-2);
}

/* --- app groups (one <details> per app) and their components --- */
.apps { display: grid; gap: 16px; margin-bottom: 40px; }

.group {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 0;
}
.group-head {
  list-style: none; cursor: pointer; padding: 18px 24px 16px; border-radius: var(--radius-lg);
  display: block;
}
.group-head::-webkit-details-marker { display: none; }
.group-head:hover { background: var(--surface-hover); }
.group-head:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.group[open] > .group-head { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.group-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chevron {
  width: 18px; height: 18px; flex: none; color: var(--muted);
  transition: transform 0.15s ease;
}
.group[open] > .group-head .chevron { transform: rotate(90deg); }
.group-name { margin: 0; font-size: 1.125rem; letter-spacing: -0.01em; }
.state-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 8px; border-radius: var(--radius-xl);
  background: var(--background); border: 1px solid var(--border);
  font-size: 0.875rem; font-weight: 600; color: var(--foreground-2);
}
.group-meta { margin-left: auto; color: var(--muted); font-size: 0.9375rem; white-space: nowrap; }
.group-meta strong { color: var(--foreground-2); font-weight: 600; }

/* 90-day bar: one flex segment per day */
.bar { display: flex; gap: 2px; height: 30px; margin: 14px 0 0; }
.day {
  flex: 1 1 0; min-width: 2px; border-radius: 2px; background: var(--border);
  transition: transform 0.08s ease;
}
.day:hover { transform: scaleY(1.2); }
.day--up { background: var(--success); }
.day--degraded { background: var(--accent-orange); }
.day--down { background: var(--destructive); }
.day--none { background: var(--border); }

/* component rows: dot · name · reading · bar · uptime */
.components { list-style: none; margin: 0; padding: 4px 24px 18px; display: grid; gap: 4px; }
.component {
  display: grid; align-items: center; gap: 6px 12px;
  grid-template-columns: 12px minmax(160px, 1fr) 72px minmax(120px, 2fr) 76px;
  padding: 8px 0; border-top: 1px solid var(--border);
}
.component:first-child { border-top: 0; }
.component-name { font-weight: 600; font-size: 0.9375rem; min-width: 0; }
.component-note { display: block; font-weight: 400; color: var(--muted); font-size: 0.8125rem; }
.component-latency, .component-uptime, .component-nodata {
  color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.component-uptime { text-align: right; color: var(--foreground-2); font-weight: 600; }
.bar--component { height: 16px; margin: 0; }
.bar--component .day { border-radius: 1px; }
.component--unknown .component-name { color: var(--muted); }
.component--unknown .component-uptime { color: var(--muted); font-weight: 400; }

.stats-unused { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.stat {
  background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 8px 12px;
}
.stat dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- incidents --- */
.incidents { margin-bottom: 40px; }
.incident-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.incident {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 18px;
}
.incident--open { border-color: var(--destructive); background: var(--surface-warm); }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: var(--radius-xl);
  font-size: 0.8125rem; font-weight: 600; background: var(--surface-hover); color: var(--foreground-2);
}
.badge--open { background: var(--destructive); color: var(--background); }
.incident-title { font-weight: 600; }
.incident-component { font-weight: 400; color: var(--muted); }
.incident-detail { grid-column: 2; color: var(--muted); font-size: 0.9375rem; }
.empty { color: var(--muted); margin: 0; }

.site-footer { color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--border); padding-top: 20px; text-align: center; }
.site-footer p { margin: 0 0 6px; }

/* --- tooltip for the day bar --- */
.tooltip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--foreground); color: var(--background);
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 0.8125rem; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}

@media (max-width: 600px) {
  /* 90 segments must fit a 390px phone: thinner gaps and segments */
  .bar { gap: 1px; }
  .day { min-width: 1px; }

  body { padding: 0 14px 40px; }
  .site-header { padding-top: 28px; }
  .group-head { padding: 14px 16px 12px; }
  .components { padding: 2px 16px 14px; }
  .banner { padding: 16px 18px; }
  .group-meta { margin-left: 0; flex-basis: 100%; white-space: normal; }
  .group-uptime { display: none; }
  /* bar on its own line: dot · name · reading · uptime, then the 90 days */
  .component {
    grid-template-columns: 12px 1fr auto auto; gap: 4px 10px;
    grid-template-areas: "dot name reading uptime" "bar bar bar bar";
  }
  .component > .dot { grid-area: dot; }
  .component-name { grid-area: name; }
  .component-latency, .component-nodata { grid-area: reading; }
  .component-uptime { grid-area: uptime; }
  .bar--component { grid-area: bar; height: 12px; }
  /* incidents: badge · severity, then the title and the detail on full rows */
  .incident-title, .incident-detail { grid-column: 1 / -1; }
  .day:hover { transform: none; }
  .tabs { margin: 0 -14px 20px; padding: 0 14px; }
  .banner-side { align-items: flex-start; }
  .provider-group { padding: 12px 16px 8px; }
  .provider-item-state { white-space: normal; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  .day, .chevron { transition: none; }
}

/* Title row with the History / back button */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.title-row h1 { margin-bottom: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 40px;
  border: 1px solid var(--border); background: var(--surface); color: var(--foreground); text-decoration: none;
  font-weight: 600; font-size: 0.9375rem; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); }
.btn-icon { width: 18px; height: 18px; }
.severity { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
