@font-face {
  font-family: "Bodoni Moda";
  src: url("../fonts/BodoniModa-Latin-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}

@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/InterTight-Latin-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --maroon: #471a27;
  --maroon-raised: #5c2635;
  --gold: #a68845;
  --cream: #faf7f0;
  --sand: #e8e0d1;
  --paper: #fffdf9;
  --ink: #241b1e;
  --muted: #675d60;
  --line: #d8cfc1;
  --positive: #176b4a;
  --warning: #8a4b08;
  --critical: #9d2235;
  --info: #225c78;
  --focus: #0069a6;
  --focus-on-sidebar: #fffaf0;
  --shadow: 0 10px 28px rgb(71 26 39 / 9%);
  font-family: "Inter Tight", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 20rem;
  background: var(--cream);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sidebar :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline-color: var(--focus-on-sidebar);
}

.skip-link {
  position: fixed;
  z-index: 100;
  inset: 0 auto auto 1rem;
  padding: 0.65rem 1rem;
  color: white;
  background: var(--maroon);
  border-radius: 0 0 0.4rem 0.4rem;
  transform: translateY(-120%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 16rem minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-height: 100vh;
  padding: 2rem 1rem;
  overflow-y: auto;
  color: #fffaf0;
  background: var(--maroon);
}

.sidebar__brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0 0.75rem;
}

.wordmark {
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.wordmark__product {
  color: #ead9ab;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.sidebar__workspace {
  margin: 0.5rem 0.75rem 1.7rem;
  color: #dfd0d4;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar__nav ul {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-item {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  color: #f5ebed;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--maroon-raised);
}

.nav-item--active {
  color: white;
  background: var(--maroon-raised);
  border-color: #b49554;
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-item--disabled {
  color: #c7b8bd;
  cursor: not-allowed;
}

.nav-item__icon {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  color: var(--maroon);
  background: #ead9ab;
  border-radius: 0.35rem;
  font-size: 0.69rem;
  font-weight: 800;
}

.nav-item__copy {
  display: grid;
  min-width: 0;
}

.nav-item__copy small {
  margin-top: 0.12rem;
  font-size: 0.7rem;
  font-weight: 450;
}

.nav-item__badge,
.kpi-card__badge {
  padding: 0.16rem 0.42rem;
  color: var(--maroon);
  background: #ead9ab;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.app-shell__body {
  display: grid;
  min-width: 0;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: 0.8rem clamp(1rem, 3vw, 2.5rem);
  background: rgb(255 253 249 / 94%);
  border-bottom: 1px solid var(--line);
}

.topbar p {
  margin: 0;
}

.topbar__realm {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar__title {
  margin-top: 0.15rem !important;
  font-weight: 700;
}

.user-chip {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 650;
}

.user-chip__initials {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 auto;
  place-items: center;
  color: white;
  background: var(--maroon);
  border-radius: 50%;
  font-size: 0.75rem;
}

.page {
  width: min(100%, 100rem);
  min-width: 0;
  padding: clamp(1.5rem, 4vw, 3.5rem);
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--critical);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-header h1 {
  margin: 0;
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 550;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  min-width: 0;
  padding: 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--info);
  border-radius: 0.65rem;
  box-shadow: var(--shadow);
}

.kpi-card--positive { border-top-color: var(--positive); }
.kpi-card--warning { border-top-color: var(--warning); }
.kpi-card--critical { border-top-color: var(--critical); }

.kpi-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.kpi-card h2,
.kpi-card p {
  margin: 0;
}

.kpi-card h2 {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kpi-card__value {
  margin-top: 0.55rem !important;
  font-size: 2rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.kpi-card__detail {
  margin-top: 0.25rem !important;
  color: var(--muted);
  font-size: 0.8rem;
}

.table-frame {
  width: 100%;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  box-shadow: var(--shadow);
}

.dense-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.dense-table caption {
  padding: 1rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  text-align: left;
}

.dense-table th,
.dense-table td {
  padding: 0.62rem 0.8rem;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.dense-table th {
  color: #564a4e;
  background: #f2ece2;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.dense-table tbody tr:hover {
  background: #fbf4e8;
}

.dense-table__actions,
.dense-table__actions-heading {
  text-align: right !important;
}

.dense-table__empty {
  padding: 2.5rem !important;
  color: var(--muted);
  text-align: center !important;
}

.status-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem clamp(1rem, 3vw, 2.5rem);
  color: var(--muted);
  background: var(--paper);
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

.status-footer__status,
.status-footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.status-footer__status--positive { color: var(--positive); }
.status-footer__status--warning { color: var(--warning); }
.status-footer__status--critical { color: var(--critical); }

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  background: currentcolor;
  border-radius: 50%;
}

.environment-badge {
  padding: 0.18rem 0.42rem;
  color: white;
  background: #564a4e;
  border-radius: 0.25rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 54rem) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    min-height: auto;
    max-height: none;
    padding: 1rem;
  }

  .sidebar__workspace {
    margin-bottom: 0.8rem;
  }

  .sidebar__nav ul {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .sidebar__nav li {
    min-width: max-content;
  }

  .nav-item {
    min-height: 2.4rem;
  }

  .nav-item__copy small {
    max-width: 10rem;
  }
}

@media (max-width: 36rem) {
  .topbar {
    align-items: flex-start;
  }

  .topbar__title,
  .user-chip__label {
    display: none;
  }

  .page {
    padding: 1.25rem 1rem 2rem;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.topbar__account {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.sign-out-button {
  padding: 0.5rem 0.7rem;
  color: var(--maroon);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.sign-out-button:hover {
  background: var(--sand);
}

.auth-page {
  display: grid;
  min-height: 100vh;
  margin: 0;
  padding: 1.25rem;
  place-items: center;
  color: var(--ink);
  background: var(--cream);
}

.auth-card {
  width: min(100%, 28rem);
  padding: clamp(2rem, 6vw, 3.5rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 0.35rem solid var(--gold);
  box-shadow: 0 1rem 3rem rgb(71 26 39 / 10%);
}

.auth-card__wordmark {
  margin: 0;
  color: var(--maroon);
  font-family: "Bodoni Moda", Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}

.auth-card__product {
  margin: 0.35rem 0 2.5rem;
  color: #72591f;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.auth-card h1 {
  margin-bottom: 0.65rem;
  color: var(--maroon);
}

.auth-button {
  display: inline-flex;
  min-height: 2.75rem;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--maroon);
  border: 2px solid var(--maroon);
  border-radius: 0.35rem;
  font-weight: 750;
  text-decoration: none;
}

.auth-button:hover {
  background: #5b2334;
}

.auth-notice {
  margin-top: 1.25rem;
  padding: 0.8rem;
  color: var(--critical);
  background: #fbecef;
  border-left: 0.25rem solid currentcolor;
}
