/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Tokens (matched from app/globals.css) ── */
:root {
  --background: #fef9f3;
  --foreground: #012742;
  --panel: #ffffff;
  --muted-foreground: hsl(215.4 16.3% 46.9%);
  --border: hsl(214.3 31.8% 91.4%);
  --radius: 20px;
  --primary: #6f5bd6;

  --ok: #148a5d;
  --ok-soft: rgba(20, 138, 93, 0.12);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --down: #d72638;
  --down-soft: rgba(215, 38, 56, 0.12);

  --shadow: 0 4px 24px rgba(1, 39, 66, 0.08);
  --max: 960px;
}

/* ── Base ── */
body {
  font-family:
    "Urbanist",
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Navigation ── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 80px;
  display: flex;
  align-items: center;
  transition:
    background 0.25s,
    box-shadow 0.25s;
}

.site-nav.scrolled {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  color: var(--foreground);
}

.nav-wordmark {
  font-size: 20px;
  font-weight: 700;
  color: var(--foreground);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.nav-links a:hover {
  opacity: 0.7;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.nav-cta:hover {
  opacity: 0.85;
}

.nav-burger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  color: var(--foreground);
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
    box-shadow: var(--shadow);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-burger {
    display: inline-flex;
    margin-left: auto;
  }
}

/* ── Decorative circles (matches layout.tsx) ── */
.bg-circles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.circle {
  position: absolute;
  border-radius: 50%;
}

.circle-orange {
  width: 160px;
  height: 160px;
  top: -80px;
  left: -80px;
  background: linear-gradient(135deg, #fdba74, #f97316);
  opacity: 0.6;
}

.circle-teal {
  width: 128px;
  height: 128px;
  top: 64px;
  right: 64px;
  background: linear-gradient(135deg, #5eead4, #14b8a6);
  opacity: 0.4;
}

.circle-blue {
  width: 128px;
  height: 128px;
  top: 50%;
  left: -64px;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #93c5fd, #3b82f6);
  opacity: 0.5;
}

.circle-purple {
  width: 192px;
  height: 192px;
  bottom: -96px;
  right: -96px;
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
  opacity: 0.3;
}

.circle-green {
  width: 96px;
  height: 96px;
  bottom: 80px;
  left: 80px;
  background: linear-gradient(135deg, #86efac, #22c55e);
  opacity: 0.5;
}

.circle-yellow {
  width: 64px;
  height: 64px;
  top: 25%;
  right: 25%;
  background: linear-gradient(135deg, #fde047, #fb923c);
  opacity: 0.3;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Layout ── */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 120px 24px 72px;
  position: relative;
  z-index: 1;
}

/* ── Hero / header ── */
.hero {
  margin-bottom: 32px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
}

.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.brand-page {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted-foreground);
}

h1 {
  font-family: "Urbanist", system-ui, sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

h2 {
  font-family: "Urbanist", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3 {
  font-family: "Urbanist", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.sub {
  color: var(--muted-foreground);
  font-size: 15px;
  max-width: 480px;
}

/* ── Card ── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Summary banner ── */
.summary {
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--muted-foreground);
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-soft);
}

.dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-soft);
}

.dot.down {
  background: var(--down);
  box-shadow: 0 0 0 4px var(--down-soft);
}

.summary-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.summary-meta {
  color: var(--muted-foreground);
  font-size: 13px;
}

/* ── Pill ── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.ok {
  background: var(--ok-soft);
  color: #0c5a3e;
}

.pill.warn {
  background: var(--warn-soft);
  color: #8d4b00;
}

.pill.down {
  background: var(--down-soft);
  color: #921926;
}

/* ── Section ── */
.section {
  margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0;
}

.section-header p {
  color: var(--muted-foreground);
  font-size: 13px;
}

/* ── Services ── */
.services {
  overflow: hidden;
}

.service-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

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

.service-name {
  font-weight: 600;
  font-size: 15px;
}

.service-meta {
  color: var(--muted-foreground);
  font-size: 13px;
  margin-top: 2px;
}

.service-status {
  font-weight: 700;
  font-size: 13px;
}

/* ── Charts ── */
.charts {
  display: grid;
  gap: 24px;
}

.chart-card {
  padding: 24px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.chart-header h3 {
  margin-bottom: 4px;
}

.chart-desc {
  color: var(--muted-foreground);
  font-size: 13px;
}

.stat {
  text-align: right;
}

.stat strong {
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.stat span {
  color: var(--muted-foreground);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Bar grid ── */
.bars {
  display: grid;
  gap: 3px;
  align-items: end;
  min-height: 80px;
}

.bars.minutes {
  grid-template-columns: repeat(48, minmax(0, 1fr));
}

.bars.hours {
  grid-template-columns: repeat(90, minmax(0, 1fr));
  min-height: 90px;
}

.bar {
  width: 100%;
  border-radius: 3px;
  background: var(--border);
  transition: transform 0.12s ease;
  min-height: 8px;
  cursor: default;
}

.bar:hover {
  transform: scaleY(1.08);
  transform-origin: bottom;
}

.bar.ok {
  background: var(--ok);
}

.bar.warn {
  background: var(--warn);
}

.bar.down {
  background: var(--down);
}

.bar.empty {
  background: var(--border);
}

/* ── Time axis ── */
.time-axis {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted-foreground);
  user-select: none;
  overflow: visible;
}

.time-axis span {
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}

/* ── Day axis (90-day weekly labels) ── */
.day-axis {
  display: grid;
  grid-template-columns: repeat(90, minmax(0, 1fr));
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted-foreground);
  user-select: none;
  overflow: visible;
}

.day-axis span {
  white-space: nowrap;
  overflow: visible;
}

/* ── Legend ── */
.legend {
  margin-top: 14px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted-foreground);
  font-size: 13px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-swatch.ok {
  background: var(--ok);
}

.legend-swatch.warn {
  background: var(--warn);
}

.legend-swatch.down {
  background: var(--down);
}

.legend-swatch.empty {
  background: var(--border);
}

/* ── Manual status banner ── */
.manual-banner-ok {
  border-left: 4px solid var(--ok);
}

.manual-banner-warn {
  border-left: 4px solid var(--warn);
}

.manual-banner-down {
  border-left: 4px solid var(--down);
}

/* ── Footer ── */
.foot {
  margin-top: 32px;
  color: var(--muted-foreground);
  font-size: 13px;
  text-align: center;
}

/* ── Alerts ── */
.loading,
.error {
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
}

.loading {
  background: rgba(111, 91, 214, 0.08);
  color: #3b2f84;
  border: 1px solid rgba(111, 91, 214, 0.2);
}

.error {
  background: var(--down-soft);
  color: #921926;
  border: 1px solid rgba(215, 38, 56, 0.2);
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .service-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat {
    text-align: left;
  }

  .summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .time-axis {
    font-size: 9px;
  }

  /* On small screens, show fewer labels */
  .time-axis span {
    visibility: hidden;
  }

  .time-axis span:nth-child(4n + 1) {
    visibility: visible;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Site footer ── */
.site-footer {
  background: var(--foreground);
  color: #c8d8e4;
  padding: 48px 0 0;
  margin-top: 48px;
  font-size: 14px;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 32px;
}

.footer-col h4 {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  color: #c8d8e4;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: #fff;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.footer-logo .nav-logo-icon {
  width: 28px;
  height: 28px;
}

.footer-tagline {
  color: #90adc0;
  font-size: 13px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 40px;
  padding: 20px 0;
  text-align: center;
  color: #90adc0;
  font-size: 13px;
}

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