:root {
  /* Brand Guide v1.0 */
  --stone: #dad5bf;
  --night: #0e0b0b;
  --sunset: #f24405;
  --sunrise: #eb6400;
  --sun: #fdac00;
  --deep-grey: #333333;
  --dusk: #36454c;
  --dark-grey: #3d3d3d;
  --mid-grey: #7d7d7d;
  --grey: #c3c3c3;
  --light-grey: #f8f8f8;
  --white: #ffffff;
  --ok: #2f6f4e;

  --bg: var(--stone);
  --text: var(--night);
  --muted: var(--deep-grey);
  --border: color-mix(in srgb, var(--night) 14%, transparent);
  --surface: color-mix(in srgb, var(--white) 55%, var(--stone));
  --banner-ok-bg: var(--ok);
  --banner-ok-fg: var(--white);
  --radius: 2px;
  --max: 920px;
  --font: "Space Grotesk", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.wrap {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

/* Header */
.site-header {
  padding: 2rem 0 1.5rem;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--night);
}

.brand img,
.brand svg {
  height: 2.75rem;
  width: auto;
}

.brand-meta {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Overall banner */
.banner {
  margin: 0.5rem 0 2.5rem;
  padding: 1.35rem 1.5rem;
  background: var(--night);
  color: var(--stone);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.banner[data-status="operational"] {
  background: var(--ok);
  color: var(--white);
}

.banner[data-status="degraded"] {
  background: var(--sun);
  color: var(--night);
}

.banner[data-status="partial_outage"] {
  background: var(--sunrise);
  color: var(--white);
}

.banner[data-status="major_outage"] {
  background: var(--sunset);
  color: var(--white);
}

.banner[data-status="maintenance"] {
  background: var(--dusk);
  color: var(--stone);
}

.banner-label {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.banner-meta {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Sections */
.section {
  margin-bottom: 2.75rem;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Services */
.service-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.service-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.service-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.service-desc {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-pill[data-status="operational"] { color: var(--ok); }
.status-pill[data-status="degraded"] { color: var(--sun); }
.status-pill[data-status="partial_outage"] { color: var(--sunrise); }
.status-pill[data-status="major_outage"] { color: var(--sunset); }
.status-pill[data-status="maintenance"] { color: var(--dusk); }

/* Incidents */
.incident {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.incident:first-child {
  border-top: 1px solid var(--border);
}

.incident-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.incident-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  flex: 1 1 100%;
}

@media (min-width: 640px) {
  .incident-title {
    flex: 1 1 auto;
  }
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.badge-critical { color: var(--sunset); }
.badge-major { color: var(--sunrise); }
.badge-minor { color: var(--sun); }
.badge-maintenance { color: var(--dusk); }

.badge-status {
  border-color: var(--border);
  color: var(--muted);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.timeline {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
}

.timeline li {
  position: relative;
  padding: 0 0 1rem 1rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -1.3rem;
  top: 0.4rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--night);
}

.timeline-time {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.timeline-body {
  margin: 0;
  white-space: pre-wrap;
}

.empty {
  padding: 1.25rem 0;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.site-footer {
  margin-top: 3rem;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.loading,
.error-state {
  padding: 2rem 0;
  color: var(--muted);
}

.error-state {
  color: var(--sunset);
}

/* Admin */
.admin-body {
  background: var(--stone);
}

.admin-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
}

.admin-nav a {
  text-decoration: none;
  font-weight: 600;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.5rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .form-grid.two {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
select,
textarea {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--night);
  border-radius: var(--radius);
  width: 100%;
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  cursor: pointer;
  padding: 0.7rem 1.1rem;
  background: var(--night);
  color: var(--stone);
  border-radius: var(--radius);
}

.btn:hover {
  background: var(--deep-grey);
}

.btn-secondary {
  background: transparent;
  color: var(--night);
  border: 1px solid var(--night);
}

.btn-secondary:hover {
  background: var(--night);
  color: var(--stone);
}

.btn-danger {
  background: var(--sunset);
  color: var(--white);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  display: none;
}

.flash.show {
  display: block;
}

.flash.ok {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
}

.flash.err {
  background: color-mix(in srgb, var(--sunset) 18%, transparent);
  color: var(--sunset);
}

.token-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.token-bar label {
  flex: 1 1 240px;
}

.incident-admin {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.incident-admin:first-of-type {
  border-top: 1px solid var(--border);
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}
