:root {
  --page: #f9f8f6;
  --line: #ebe7e1;
  --ink: #17151f;
  --ink-2: #4a4756;
  --muted: #6e6b78;
  --faint: #9a97a5;
  --card: #ffffff;
  --card-line: #e7e5ee;
  --row-line: #efeef3;
  --head: #fafafb;
  --accent: #6c5ce7;
  --accent-2: #a89ef5;
  --accent-3: #d6d1fb;
  --accent-4: #ece9fe;
  --mint: #7fd3bd;
  --up: #3e8f66;
  --down: #c8414b;
  --tile-a: #f1effe;
  --tile-b: #e7e3fc;
  --tile-line: #e3dffa;
  --shadow: 0 1px 2px rgba(23, 20, 50, 0.04), 0 14px 36px -14px rgba(64, 44, 170, 0.18);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 14.5px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.94em; color: var(--muted); }

/* ---------- frame: the thin ruled box the whole page sits in ---------- */
.frame {
  max-width: 1180px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.top {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(249, 248, 246, 0.86);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; letter-spacing: -0.01em; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(140deg, #8a7cf0, var(--accent));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.tabs { display: flex; gap: 4px; }
.tabs a {
  padding: 6px 11px; border-radius: 8px; color: var(--muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.tabs a:hover { color: var(--ink); background: rgba(108, 92, 231, 0.06); }
.tabs a.on { color: var(--ink); background: #fff; box-shadow: 0 0 0 1px var(--card-line); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.seg {
  display: flex; padding: 3px; gap: 2px; border-radius: 9px;
  background: #fff; box-shadow: 0 0 0 1px var(--card-line);
  position: relative;
}
.seg button {
  border: 0; background: none; padding: 4px 11px; border-radius: 6px; cursor: pointer;
  color: var(--muted); font-size: 13px; position: relative; z-index: 1;
  transition: color 0.25s var(--ease);
}
.seg button.on { color: #fff; }
.seg .thumb {
  position: absolute; top: 3px; bottom: 3px; border-radius: 6px; background: var(--accent);
  transition: left 0.38s var(--ease), width 0.38s var(--ease);
}
.health { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.up { background: #3fae7a; box-shadow: 0 0 0 3px rgba(63, 174, 122, 0.16); }
.dot.down { background: var(--down); box-shadow: 0 0 0 3px rgba(200, 65, 75, 0.16); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(200, 65, 75, 0.05); } }

main { flex: 1; }
.foot { border-top: 1px solid var(--line); padding: 22px; text-align: center; color: var(--faint); font-size: 13px; }

/* ---------- hero: lavender field with grain pooled in the corners ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 64px 76px 84px;
  background: #e6e2fd;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}
.hero::before, .hero::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero::before {
  background:
    radial-gradient(60% 55% at 6% 4%, #7d6ef0 0%, rgba(125, 110, 240, 0) 70%),
    radial-gradient(45% 60% at 100% 62%, #7a6bef 0%, rgba(122, 107, 239, 0) 70%),
    radial-gradient(40% 40% at 92% 100%, #8b7ef2 0%, rgba(139, 126, 242, 0) 70%),
    radial-gradient(70% 60% at 50% 40%, #ece9fe 0%, rgba(236, 233, 254, 0) 70%);
}
.hero::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.6 -0.75'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.75;
  -webkit-mask-image: radial-gradient(60% 60% at 6% 4%, #000 0%, transparent 72%), radial-gradient(50% 60% at 100% 62%, #000 0%, transparent 72%), radial-gradient(45% 45% at 92% 100%, #000 0%, transparent 72%);
  mask-image: radial-gradient(60% 60% at 6% 4%, #000 0%, transparent 72%), radial-gradient(50% 60% at 100% 62%, #000 0%, transparent 72%), radial-gradient(45% 45% at 92% 100%, #000 0%, transparent 72%);
}
.stage { position: relative; }
.stage .main-card { width: min(100%, 754px); }
.float-card {
  position: absolute; right: -22px; top: 232px; width: 452px; z-index: 2;
}
.toast-card {
  position: absolute; left: -44px; bottom: -56px; z-index: 3; width: 300px;
}
.caption { text-align: center; color: var(--faint); font-size: 13.5px; padding: 18px 20px; border-bottom: 1px solid var(--line); }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 22px 18px; }
.card-head h1, .card-head h2 { margin: 0; font-weight: 400; letter-spacing: -0.015em; }
.card-head h1 { font-size: 19px; }
.card-head h2 { font-size: 17px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.big { font-size: 22px; letter-spacing: -0.02em; text-align: right; }
.delta { font-size: 12px; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--faint); }
.delta .vs { color: var(--faint); }

.btn {
  border: 0; border-radius: 7px; padding: 8px 13px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 13.5px; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(60, 40, 170, 0.25);
  transition: transform 0.18s var(--ease), background 0.2s var(--ease);
}
.btn:hover { background: #5f4fe0; }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--card-line); }
.btn.ghost:hover { background: var(--head); }
.btn.dark { background: #111; box-shadow: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 0 22px 22px; }
.stat { border: 1px solid var(--card-line); border-radius: 10px; padding: 14px 15px 13px; min-width: 0; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 25px; letter-spacing: -0.025em; margin: 4px 0 3px; line-height: 1.2; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-weight: 400; color: var(--faint); font-size: 12px;
  padding: 10px 22px; background: var(--head);
  border-top: 1px solid var(--row-line); border-bottom: 1px solid var(--row-line);
}
.table td { padding: 12px 22px; border-bottom: 1px solid var(--row-line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.18s var(--ease); }
.table tbody tr.link { cursor: pointer; }
.table tbody tr.link:hover { background: #fbfaff; }
.table .r { text-align: right; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1;
  padding: 4px 7px; border-radius: 5px; border: 1px solid; white-space: nowrap;
}
.pill.up { background: #edf6ef; border-color: #cfe5d5; color: #3c7a55; }
.pill.down { background: #fdeeee; border-color: #f3cfd1; color: #b13b44; }
.pill.pending { background: #fff4e5; border-color: #f6dcb5; color: #b06d1f; }
.pill.none { background: #f5f4f7; border-color: #e6e4ec; color: var(--muted); }

/* ---------- tile grid under the hero ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.cell { padding: 14px 14px 26px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.cell:nth-child(3n) { border-right: 0; }
.cell.span2 { grid-column: span 2; }
.grid.two .cell:nth-child(3n) { border-right: 1px solid var(--line); }
.grid.two .cell:last-child { border-right: 0; }
.tile {
  border-radius: 14px; border: 1px solid var(--tile-line);
  background: linear-gradient(160deg, var(--tile-a) 0%, var(--tile-b) 100%);
  padding: 22px 20px 0; height: 240px; overflow: hidden; position: relative;
}
.tile.tall { height: 300px; }
.tile .card { border-radius: 10px; box-shadow: 0 1px 2px rgba(23, 20, 50, 0.04), 0 10px 28px -12px rgba(64, 44, 170, 0.16); }
.tile.fade::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34px;
  background: linear-gradient(transparent, var(--tile-b)); pointer-events: none;
}
.cell h3 { margin: 18px 10px 6px; font-weight: 400; font-size: 16.5px; letter-spacing: -0.01em; }
.cell p { margin: 0 10px; color: var(--muted); font-size: 14px; line-height: 1.65; max-width: 460px; }

/* rows inside tile cards */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid var(--row-line); font-size: 13.5px; min-width: 0;
}
.rows li:last-child { border-bottom: 0; }
.rows .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .time { color: var(--faint); font-size: 12px; width: 34px; flex: none; }
.rows .tag { color: var(--faint); font-size: 12px; flex: none; }
.rows.compact li { padding: 9px 14px; }
.foot-note { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 12px; padding: 10px 14px; border-top: 1px solid var(--row-line); }

/* horizontal bars (Performance-by-theme style) */
.bars { padding: 16px 18px 6px; }
.bars h4 { margin: 0; font-weight: 400; font-size: 15.5px; }
.bars .sub { margin-bottom: 12px; }
.bar-row { display: grid; grid-template-columns: 116px 1fr 52px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 13px; border-radius: 4px; background: #f1f0f5; overflow: hidden; display: flex; }
.bar-track span { height: 100%; transform-origin: left; animation: grow 0.9s var(--ease) both; }
.bar-row .v { text-align: right; color: var(--muted); font-size: 12.5px; }
@keyframes grow { from { transform: scaleX(0); } }

/* comparison meters (Size-up-a-competitor style) */
.meter { padding: 18px 18px 14px; }
.meter .row { display: flex; justify-content: space-between; font-size: 13.5px; margin: 12px 0 7px; }
.meter .track { height: 9px; border-radius: 5px; background: #f1f0f5; overflow: hidden; }
.meter .fill { height: 100%; border-radius: 5px; background: var(--accent); transform-origin: left; animation: grow 1s var(--ease) both; }
.meter .note { margin-top: 14px; font-size: 13px; color: var(--ink-2); }

/* uptime strips */
.strip { display: flex; gap: 2px; height: 22px; align-items: stretch; }
.strip i { flex: 1; border-radius: 2px; background: #e9e7ef; animation: rise 0.5s var(--ease) both; }
.strip i.ok { background: #8fd1b0; }
.strip i.warn { background: #f1c27d; }
.strip i.bad { background: #e88a91; }
@keyframes rise { from { transform: scaleY(0.2); opacity: 0; } }

/* charts */
.chart { position: relative; padding: 4px 22px 16px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #ebeaf1; stroke-dasharray: 3 4; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.draw { animation: draw 1.2s var(--ease) both; }
.chart .area { animation: fade 0.9s 0.25s var(--ease) both; }
.chart .end { fill: #fff; stroke: var(--accent); stroke-width: 1.6; animation: fade 0.4s 1s both; }
.chart .axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 11.5px; margin-top: 10px; }
.chart .hover-line { stroke: var(--accent-2); stroke-width: 1; opacity: 0; transition: opacity 0.15s; }
.chart .hover-dot { fill: var(--accent); opacity: 0; transition: opacity 0.15s; }
.chart.hovering .hover-line, .chart.hovering .hover-dot { opacity: 1; }
.chart .tip {
  position: absolute; top: 0; pointer-events: none; background: var(--ink); color: #fff;
  font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; opacity: 0;
  transform: translate(-50%, -6px); transition: opacity 0.15s;
}
.chart.hovering .tip { opacity: 1; }
@keyframes draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }

.spark { width: 72px; height: 22px; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }

/* toast-like note */
.note-card { display: flex; gap: 14px; align-items: center; padding: 15px 16px; }
.note-icon {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent-4); color: var(--accent);
  display: grid; place-items: center; flex: none;
}
.note-icon.bad { background: #fdeeee; color: var(--down); }
.note-card b { display: block; font-weight: 400; font-size: 14px; }
.note-card span { color: var(--muted); font-size: 12.5px; }

/* settings + forms */
.page { padding: 48px 76px 64px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); }
.input {
  border: 1px solid var(--card-line); border-radius: 8px; padding: 9px 11px; background: #fff; width: 100%;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input:focus { outline: 0; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12); }
.form-row { display: grid; grid-template-columns: 1.2fr 1.6fr 0.8fr auto; gap: 10px; align-items: end; padding: 18px 22px 22px; border-top: 1px solid var(--row-line); }
.snippet {
  font-family: var(--mono); font-size: 12px; background: #faf9fd; border: 1px solid var(--card-line);
  border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; color: var(--ink-2);
}
.edit-panel { padding: 0 22px 18px; display: grid; gap: 12px; animation: open 0.35s var(--ease) both; }
@keyframes open { from { opacity: 0; transform: translateY(-4px); } }
.err { color: var(--down); font-size: 13px; }

/* sign in */
.signin { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 40px 20px; }
.signin .card { width: min(100%, 380px); padding: 26px; display: grid; gap: 14px; }

/* empty states */
.empty { padding: 26px 18px; text-align: center; color: var(--faint); font-size: 13px; }

/* ---------- route + content motion ---------- */
.enter > * { animation: enter 0.55s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: 0.06s; }
.enter > *:nth-child(3) { animation-delay: 0.12s; }
.enter > *:nth-child(4) { animation-delay: 0.18s; }
.float-card, .toast-card { animation: float-in 0.8s 0.25s var(--ease) both; }
.toast-card { animation-delay: 0.45s; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
@keyframes float-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.leaving { opacity: 0; transform: translateY(-6px); transition: opacity 0.18s ease, transform 0.18s ease; }
.refreshing .value, .refreshing .big { opacity: 0.45; transition: opacity 0.2s; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 50; }
#toasts .card { animation: float-in 0.45s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero { padding: 48px 40px 64px; }
  .float-card { position: relative; right: auto; top: auto; width: auto; margin: 18px 0 0 auto; max-width: 560px; }
  .stage .main-card { width: 100%; }
  .toast-card { position: relative; left: auto; bottom: auto; margin-top: 18px; }
  .page { padding: 40px 40px 56px; }
}
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .cell, .cell:nth-child(3n), .grid.two .cell:nth-child(3n) { border-right: 0; }
  .cell.span2 { grid-column: auto; }
  .top { flex-wrap: wrap; row-gap: 10px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .tabs a { white-space: nowrap; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { padding: 14px 16px; gap: 12px; }
  .health .label { display: none; }
  .hero { padding: 28px 16px 40px; }
  .page { padding: 24px 16px 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); padding: 0 16px 16px; }
  .stat .vs { display: none; }
  .card-head { padding: 18px 16px 14px; }
  .table th, .table td { padding: 10px 16px; }
  .table .hide-sm { display: none; }
  .chart { padding: 4px 16px 14px; }
  .float-card, .toast-card { width: 100%; max-width: none; }
  .bar-row { grid-template-columns: 90px 1fr 44px; }
  .frame { border: 0; }
}
