/* Atajix Decoupled Status Page Stylesheet
 * Direction A: Ligne Claire & Spot-Color Cartography
 * Default: Light Theme (Litho Paper #F6EFE1 / Clean Cream #FFFDF8)
 * Toggle: Dark Theme (Earthy Charcoal #1C1712 / Dark Stone #2A2319)
 */

:root,
html.light,
[data-theme="light"] {
  --bg-canvas: #F6EFE1;
  --bg-surface: #FFFDF8;
  --bg-surface-raised: #EFE6D2;
  --border-color: #C9BBA0;
  --border-strong: #8C7F63;
  --text-primary: #241F19;
  --text-muted: #6B6153;
  --text-disabled: #A79C89;
  --accent-gold: #B27E0C;
  --accent-brick: #A3401F;
  --accent-green: #286A32;
  --accent-blue: #3E6E9E;
  --focus-ring: #B5820F;
  --selection-bg: #B5820F;
  --selection-text: #FFFDF8;
  --uptime-bar-bg: #357C3F;
  --badge-bg-healthy: rgba(53, 124, 63, 0.12);
  --badge-border-healthy: rgba(53, 124, 63, 0.35);
  --badge-bg-degraded: rgba(181, 130, 15, 0.12);
  --badge-border-degraded: rgba(181, 130, 15, 0.35);
  --badge-bg-outage: rgba(163, 64, 31, 0.12);
  --badge-border-outage: rgba(163, 64, 31, 0.35);
  --banner-bg-healthy: #EAF4EC;
  --banner-border-healthy: #357C3F;
  --banner-bg-degraded: #FEF6E4;
  --banner-border-degraded: #B5820F;
  --banner-bg-outage: #FBECE8;
  --banner-border-outage: #A3401F;
}

html.dark,
[data-theme="dark"] {
  --bg-canvas: #1C1712;
  --bg-surface: #2A2319;
  --bg-surface-raised: #332A1E;
  --border-color: #4A3F2E;
  --border-strong: #6B5B42;
  --text-primary: #F3ECDD;
  --text-muted: #B8AC97;
  --text-disabled: #7A705F;
  --accent-gold: #D9A215;
  --accent-brick: #C1502E;
  --accent-green: #4C9A4C;
  --accent-blue: #5A8FC2;
  --focus-ring: #D9A215;
  --selection-bg: #D9A215;
  --selection-text: #1C1712;
  --uptime-bar-bg: #4C9A4C;
  --badge-bg-healthy: rgba(76, 154, 76, 0.15);
  --badge-border-healthy: rgba(76, 154, 76, 0.4);
  --badge-bg-degraded: rgba(217, 162, 21, 0.15);
  --badge-border-degraded: rgba(217, 162, 21, 0.4);
  --badge-bg-outage: rgba(193, 80, 46, 0.15);
  --badge-border-outage: rgba(193, 80, 46, 0.4);
  --banner-bg-healthy: #152A1C;
  --banner-border-healthy: #4C9A4C;
  --banner-bg-degraded: #2E2310;
  --banner-border-degraded: #D9A215;
  --banner-bg-outage: #331A14;
  --banner-border-outage: #C1502E;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--text-primary);
}

/* Universal Link Reset & Anti-Underline Invariants */
a,
a:visited,
a:hover,
a:active,
a:focus {
  text-decoration: none;
  color: inherit;
}

/* Sticky Top Section (Option A: Sticky on Desktop, Natural on Mobile) */
.status-sticky-container {
  position: static;
  width: 100%;
  background-color: var(--bg-canvas);
  border-bottom: none;
  box-shadow: none;
  transition: background-color 0.2s ease;
}

@media (min-width: 640px) {
  .status-sticky-container {
    position: sticky;
    top: 0;
    z-index: 50;
  }
}

.status-sticky-inner {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 1rem;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .status-sticky-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 0;
    gap: 1.15rem;
  }
}

@media (min-width: 1024px) {
  .status-sticky-inner {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (max-width: 639px) {
  .status-banner {
    padding: 0.85rem 1rem;
  }
  .metric-card {
    padding: 0.65rem 0.75rem;
    gap: 0.15rem;
  }
  .metric-value {
    font-size: 1.1rem;
  }
}

/* Scrollable Content Container (Everything below Historial 90 Días) */
.status-scroll-container {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 1rem;
  padding-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 640px) {
  .status-scroll-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-top: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .status-scroll-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Header & Brand Architecture */
.status-header {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-color);
  align-items: flex-start;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .status-header {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }
}

.brand-wrapper {
  display: flex;
  align-items: center;
}

.brand-link,
.brand-link:visited,
.brand-link:hover,
.brand-link:focus,
.brand-link:active,
.brand-link * {
  text-decoration: none !important;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 0.25rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 0.75rem;
  transition: background-color 0.15s ease;
  outline: none;
}

.brand-link:hover {
  background-color: rgba(181, 130, 15, 0.05);
}

.brand-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: linear-gradient(145deg, var(--bg-surface) 0%, var(--bg-surface-raised) 100%);
  border: 1.5px solid var(--accent-gold);
  box-shadow: 0 1px 3px rgba(36, 31, 25, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.brand-link:hover .brand-badge {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 12px rgba(181, 130, 15, 0.22);
  border-color: var(--accent-gold);
}

.brand-monogram {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--accent-gold);
  display: block;
  user-select: none;
  transform: translateY(-0.5px);
  letter-spacing: -0.04em;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.brand-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.2;
  display: inline;
}

.brand-gold {
  color: var(--accent-gold);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 0.15rem;
  font-weight: 400;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background-color: var(--badge-bg-healthy);
  color: var(--accent-green);
  border: 1px solid var(--badge-border-healthy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
  vertical-align: middle;
}

.status-tag-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
  background-color: var(--accent-green);
  box-shadow: 0 0 0 2px var(--badge-bg-healthy);
}

/* Header Controls & Secondary Buttons */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 0.85rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-secondary:hover {
  background-color: var(--bg-surface-raised);
  border-color: var(--border-strong);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn-icon-only {
  width: 2.25rem;
  padding: 0;
  justify-content: center;
  font-size: 0.95rem;
}

#langFlag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#langFlag svg {
  width: 0.875rem;
  height: 0.875rem;
  display: block;
}

/* Status Banner */
.status-banner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

@media (min-width: 640px) {
  .status-banner {
    flex-direction: row;
    align-items: center;
  }
}

.banner-healthy {
  background-color: var(--banner-bg-healthy);
  border: 1px solid var(--banner-border-healthy);
  color: var(--text-primary);
}

.banner-degraded {
  background-color: var(--banner-bg-degraded);
  border: 1px solid var(--banner-border-degraded);
  color: var(--text-primary);
}

.banner-outage {
  background-color: var(--banner-bg-outage);
  border: 1px solid var(--banner-border-outage);
  color: var(--text-primary);
}

/* Pulse Indicator */
.pulse-indicator {
  position: relative;
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ping-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background-color: var(--accent-green);
  opacity: 0.6;
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.dot-circle {
  position: relative;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 9999px;
  background-color: var(--accent-green);
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Metrics Grid */
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

.metric-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Component Row */
#componentsList {
  min-height: 800px;
}

.component-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  transition: border-color 0.15s ease;
}

.component-card:hover {
  border-color: var(--border-strong);
}

.component-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.component-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
}

.component-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background-color: var(--badge-bg-healthy);
  color: var(--accent-green);
  border: 1px solid var(--badge-border-healthy);
}

.badge-degraded {
  background-color: var(--badge-bg-degraded);
  color: var(--accent-gold);
  border-color: var(--badge-border-degraded);
}

.badge-outage {
  background-color: var(--badge-bg-outage);
  color: var(--accent-brick);
  border-color: var(--badge-border-outage);
}

/* Uptime Bar */
.uptime-track {
  display: flex;
  gap: 2px;
  height: 20px;
  width: 100%;
  align-items: center;
}

.uptime-day {
  flex: 1;
  height: 100%;
  border-radius: 1px;
  background-color: var(--uptime-bar-bg);
  opacity: 0.9;
  transition: opacity 0.15s ease, transform 0.15s ease;
  position: relative;
}

.uptime-day:hover {
  opacity: 1;
  transform: scaleY(1.2);
}

.uptime-day.degraded {
  background-color: var(--accent-gold);
}

.uptime-day.outage {
  background-color: var(--accent-brick);
}

.uptime-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Incident Cards */
.incident-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.badge-resolved {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--badge-bg-healthy);
  color: var(--accent-green);
  border: 1px solid var(--badge-border-healthy);
  font-family: 'Space Grotesk', sans-serif;
}

.timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.timeline-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.dot-resolved { background-color: var(--accent-green); }
.dot-monitoring { background-color: var(--accent-blue); }
.dot-identified { background-color: var(--accent-gold); }
.dot-investigating { background-color: var(--text-muted); }

/* ==========================================================================
   Defensive Utilities & Layout Engine (Zero-CDN Self-Contained Integrity)
   ========================================================================== */

/* Critical Visibility & SVG Invariants */
.hidden {
  display: none !important;
}

svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  max-width: 100%;
}

/* Icon & Box Sizing */
.w-1\.5 { width: 0.375rem; }
.h-1\.5 { height: 0.375rem; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-3\.5 { width: 0.875rem; }
.h-3\.5 { height: 0.875rem; }
.w-4 { width: 1rem; }

/* Container & Layout */
.max-w-4xl { max-width: 56rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }

.space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 2rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Media Queries (Responsive Breakpoints) */
@media (min-width: 640px) {
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:gap-4 { gap: 1rem; }
  .sm\:block { display: block; }
  .sm\:text-xl { font-size: 1.25rem; line-height: 1.75rem; }
  .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
}

@media (min-width: 1024px) {
  .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* Typography, Font & Alignment */
.font-sans { font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif; }
.font-heading { font-family: 'Space Grotesk', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.uppercase { text-transform: uppercase; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-\[11px\] { font-size: 11px; line-height: 16px; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }

/* Colors & Surfaces */
.text-primary { color: var(--text-primary); }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--text-primary); }
.text-slate-300 { color: var(--text-muted); }
.text-slate-400 { color: var(--text-muted); }
.text-slate-600 { color: var(--text-muted); }
.text-amber-400 { color: var(--accent-gold); }
.text-emerald-400 { color: var(--accent-green); }
.bg-slate-900 { background-color: var(--bg-surface-raised); }
.bg-emerald-400 { background-color: var(--accent-green); }
.bg-current { background-color: currentColor; }

/* Shapes, Borders & Spacing */
.rounded-full { border-radius: 9999px; }

.border { border-width: 1px; border-style: solid; border-color: var(--border-color); }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: var(--border-color); }
.border-t { border-top-width: 1px; border-top-style: solid; border-top-color: var(--border-color); }
.border-slate-800 { border-color: var(--border-color); }
.border-slate-800\/80 { border-color: var(--border-color); }

.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-12 { padding-bottom: 3rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.mt-0\.5 { margin-top: 0.125rem; }

/* Transitions & Micro-Interactions */
.transition { transition: all 0.15s ease; }
.hover\:text-amber-400:hover { color: var(--accent-gold); }

