:root {
  --brand: #0072c6;
  --brand-dark: #0052a3;
  --primary: #0072c6;
  --navy: #0a1e3d;
  --bg: #f0f2f5;
  --surface: #ffffff;
  --text: #4a5568;
  --heading: #0a1e3d;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --ok: #22c55e;
  --warn: #f59e0b;
  --partial: #f97316;
  --down: #ef4444;
  --maint: #0072c6;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(2, 20, 55, 0.08);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Poppins", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(0,114,198,.12), transparent 60%),
    radial-gradient(700px 360px at 100% 0%, rgba(0,89,153,.08), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  color: var(--heading);
  letter-spacing: -0.02em;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: #000;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
}

.brand:hover { text-decoration: none; color: #fff; }

.brand-logo {
  height: 44px;
  width: auto;
  max-width: 200px;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  overflow: visible;
  flex-shrink: 0;
  box-shadow: none;
}

.brand-logo.brand-logo-img {
  width: auto;
  height: 44px;
}

.brand-logo img {
  height: 44px;
  width: auto;
  max-width: min(220px, 55vw);
  object-fit: contain;
  background: transparent;
  display: block;
}

.brand-logo .placeholder {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 4px;
}

.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.2;
  color: #fff;
  font-weight: 700;
}

.brand-text span {
  font-size: 0.78rem;
  color: rgba(255,255,255,.65);
}

.site-header .header-link,
.site-header a.small {
  color: rgba(255,255,255,.8) !important;
  font-weight: 600;
  text-decoration: none;
}
.site-header a.small:hover { color: #fff !important; }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.hero-status {
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  animation: fadeUp 0.45s ease both;
}

.hero-status.operational { background: linear-gradient(135deg, #16a34a, #22c55e); }
.hero-status.degraded { background: linear-gradient(135deg, #d97706, #f59e0b); }
.hero-status.partial_outage { background: linear-gradient(135deg, #ea580c, #f97316); }
.hero-status.major_outage { background: linear-gradient(135deg, #dc2626, #ef4444); }
.hero-status.maintenance { background: linear-gradient(135deg, #2563eb, #3b82f6); }

.hero-status .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.25);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.hero-status h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight: 700;
}

.hero-status p {
  margin: 0.2rem 0 0;
  opacity: 0.92;
  font-size: 0.92rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
  animation: fadeUp 0.5s ease both;
}

.card::before,
.form-card::before,
.stat::before,
.table-wrap::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #0052a3, #0072c6, #4da6ff);
}

.card-h {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-h h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.card-b { padding: 0; }

.status-alert {
  border-color: #fecaca;
  box-shadow: 0 1px 2px rgba(127, 29, 29, 0.06), 0 8px 24px rgba(127, 29, 29, 0.08);
}

.status-alert .card-h {
  background: #fff7f7;
  border-bottom-color: #fee2e2;
}

.status-alert .card-h h2 {
  color: #b91c1c;
}

.status-alert .pill {
  background: #dc2626 !important;
}

.status-alert .t-status {
  color: #b91c1c !important;
}

.status-alert .incident {
  border-left: 4px solid #dc2626;
  padding-left: calc(1.25rem - 4px);
}

.status-alert-maintenance .incident {
  border-left-color: #dc2626;
}

.category-label {
  padding: 0.65rem 1.25rem;
  background: #e8f3fc;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.service-row:last-child { border-bottom: 0; }

.service-meta { min-width: 0; }
.service-meta strong {
  display: block;
  font-size: 0.95rem;
}
.service-meta span {
  font-size: 0.8rem;
  color: var(--muted);
}

.service-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.uptime-bar {
  display: flex;
  gap: 1px;
  height: 28px;
  align-items: flex-end;
}

.uptime-bar i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: var(--ok);
}

.uptime-bar i.degraded { background: var(--warn); }
.uptime-bar i.partial_outage { background: var(--partial); }
.uptime-bar i.major_outage { background: var(--down); }
.uptime-bar i.maintenance { background: var(--maint); }
.uptime-bar i.nodata { background: #e2e8f0; }

.uptime-pct {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 3.5rem;
  text-align: right;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status .sdot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.incident {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.incident:last-child { border-bottom: 0; }

.incident-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.incident-title a {
  color: inherit;
  font-weight: 700;
  font-size: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
}

.incident-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 1.1rem;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: var(--border);
}

.timeline li {
  position: relative;
  padding: 0 0 1rem 1rem;
}

.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: "";
  position: absolute;
  left: -1.1rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}

.timeline .t-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.timeline .t-msg {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
}

.timeline .t-time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.empty {
  padding: 1.5rem 1.25rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.95rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Admin (legacy sidebar kept for safety; primary UI uses xc-admin-topbar) */
.admin-body.xc-admin-body {
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(0,114,198,.12), transparent 60%),
    #f0f4fa;
}
.admin-content-wrap { padding-bottom: 2rem; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-nav {
  width: 240px;
  background: #000;
  color: #cbd5e1;
  padding: 1.25rem 0;
  flex-shrink: 0;
}
.admin-nav .logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1.25rem 1.25rem;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.75rem;
}
.admin-nav .logo .sq {
  width: 32px; height: 32px; border-radius: 8px; background: var(--brand);
  box-shadow: 0 4px 14px rgba(0,114,198,.35);
}
.admin-nav a {
  display: block;
  padding: 0.65rem 1.25rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.92rem;
}
.admin-nav a:hover, .admin-nav a.active {
  color: #fff;
  background: rgba(0,114,198,.35);
  box-shadow: inset 3px 0 0 #0072c6;
  text-decoration: none;
}
.admin-main { flex: 1; min-width: 0; }
.admin-top {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-content { padding: 1.5rem; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat .l { color: var(--muted); font-size: 0.8rem; margin-top: 0.35rem; }

.table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table.data th {
  background: #e8f3fc;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
table.data tr:last-child td { border-bottom: 0; }

.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  max-width: 720px;
}
.form-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.35rem; }
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border);
}
.btn-brand {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0,114,198,.28);
}
.btn-brand:hover { background: var(--brand-dark); border-color: transparent; color: #fff; filter: none; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  font-family: var(--font-display);
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(0,114,198,.16), transparent 60%),
    radial-gradient(700px 360px at 100% 0%, rgba(0,0,0,.06), transparent 55%),
    #f0f4fa;
}
.login-box {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 22px;
  padding: 2rem;
  box-shadow: 0 18px 40px rgba(15,40,80,.08);
  border: 1px solid #e2eaf4;
}
.login-box .logo-mark {
  width: 48px; height: 48px; border-radius: 12px; background: var(--brand);
  margin: 0 auto 1rem;
  box-shadow: 0 6px 18px rgba(0,114,198,.28);
}

.embed-code {
  background: #0b1220;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.alert { border-radius: 8px; }

.admin-toggle {
  display: none;
  background: none;
  border: 0;
  color: #fff;
  font-size: 1.4rem;
  padding: 0 1.25rem 0.75rem;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255,255,255,0.25); }
  50% { box-shadow: 0 0 0 10px rgba(255,255,255,0.12); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 768px) {
  .uptime-bar { display: none; }
  .service-row { flex-wrap: wrap; }
  .admin-shell { flex-direction: column; }
  .admin-nav {
    width: 100%;
    padding: 0.75rem 0;
  }
  .admin-nav.collapsed .nav-links { display: none; }
  .admin-toggle { display: block; }
  .hero-status { align-items: flex-start; }
}

@media (max-width: 480px) {
  .uptime-pct { display: none; }
  .brand-text span { display: none; }
}
