:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-strong: #eef4ff;
  --surface-soft: #f8fbff;
  --text: #17324d;
  --muted: #647789;
  --border: #d8e2ef;
  --blue: #1259c3;
  --green: #1f9d71;
  --yellow: #d79c16;
  --orange: #dc6b2f;
  --red: #c33c54;
  --shadow: 0 18px 42px rgba(12, 45, 92, 0.08);
  --shadow-strong: 0 34px 72px rgba(9, 27, 48, 0.24);
  --radius: 18px;
  --font-body: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  --font-display: "Bahnschrift", "Franklin Gothic Medium", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(18, 89, 195, 0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(31, 157, 113, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body.panel-modal-open { overflow: hidden; }

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

code {
  font-family: "Cascadia Code", "Consolas", monospace;
}

.panel-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  padding: 28px 22px;
  background: linear-gradient(180deg, #000000, #0e141c 55%, #264c7f);
  color: #f1f7ff;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  gap: 14px;
}

.brand strong,
.page-header h1,
.login-card h1,
.card h2,
.detail-header h2 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.brand-sidebar {
  display: grid;
  gap: 16px;
  justify-items: start;
}

.brand-copy {
  display: grid;
  gap: 6px;
  width: 100%;
}

.brand-copy strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: center;
}

.brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
}

.brand-logo-sidebar {
  width: min(220px, 100%);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 12px;
  color: rgba(241, 247, 255, 0.85);
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.logout-form {
  margin-top: auto;
}

.session-user {
  font-size: 0.9rem;
  color: rgba(241, 247, 255, 0.8);
  margin-bottom: 10px;
}

.content {
  padding: 34px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 6px 0;
  font-size: clamp(1.8rem, 2vw, 2.4rem);
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.header-actions,
.pill-row,
.pagination,
.diagnostic-actions,
.inline-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.diagnostic-actions {
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.inline-controls {
  flex-wrap: wrap;
}

.inline-field {
  min-width: 132px;
  display: grid;
  gap: 6px;
}

.inline-field span {
  font-size: 0.82rem;
  color: var(--muted);
}

.card,
.metric-card,
.login-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 226, 239, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  padding: 22px;
  margin-bottom: 22px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-card strong {
  font-size: 1.9rem;
}

.metric-card.success {
  border-top: 4px solid var(--green);
}

.metric-card.warning {
  border-top: 4px solid var(--yellow);
}

.metric-card.danger {
  border-top: 4px solid var(--red);
}

.metric-card.accent {
  border-top: 4px solid var(--orange);
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a62c7, #2aa574);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.button-secondary {
  background: #e8eef7;
  color: var(--text);
}

.button-ghost,
.link-button {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--border);
}

.button.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.button[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #e8eef7;
  color: var(--text);
}

.badge.success,
.badge.ready {
  background: rgba(31, 157, 113, 0.15);
  color: #156f52;
}

.badge.warning,
.badge.degraded {
  background: rgba(215, 156, 22, 0.18);
  color: #9f6b08;
}

.badge.error,
.badge.fault {
  background: rgba(195, 60, 84, 0.16);
  color: #9b1d3f;
}

.badge.muted {
  background: #edf2f8;
  color: var(--muted);
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

thead th {
  position: sticky;
  top: 0;
  background: #f8fbff;
  z-index: 1;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

label span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0 14px;
  background: #fff;
  color: var(--text);
}

input::placeholder {
  color: #8a99aa;
}

.panel-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1400;
}

.panel-modal.open {
  display: block;
}

.panel-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 24, 43, 0.58);
}

.panel-modal-dialog {
  position: relative;
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  background: linear-gradient(180deg, #fcfdff, #f4f8fd);
  border: 1px solid rgba(216, 226, 239, 0.9);
  border-radius: 26px;
  box-shadow: var(--shadow-strong);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-modal-toolbar {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.panel-modal-close {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

.panel-modal-content {
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
}

.detail-view,
.diagnostic-view {
  display: grid;
  gap: 20px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.detail-header h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.6rem, 2vw, 2.1rem);
}

.detail-header p {
  margin: 0;
}

.detail-summary-card {
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
}

.detail-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.detail-field {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid rgba(216, 226, 239, 0.88);
}

.detail-label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.73rem;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.detail-field span,
.detail-field strong,
.detail-field code {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.payload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.payload-card {
  min-width: 0;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  box-shadow: 0 10px 22px rgba(15, 45, 87, 0.06);
}

.payload-card-full {
  grid-column: 1 / -1;
}

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

.payload-header h3 {
  margin: 0;
  font-size: 1rem;
}

.payload-code {
  margin: 0;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(216, 226, 239, 0.92);
  background: #0f2236;
  color: #eff7ff;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.empty-state {
  padding: 26px;
  text-align: center;
  color: var(--muted);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(520px, calc(100vw - 32px));
  padding: 34px 34px 30px;
}

.login-branding {
  display: grid;
  justify-items: center;
  gap: 18px;
  margin-bottom: 22px;
  text-align: center;
}

.login-brand-title {
  margin: 0;
  font-size: clamp(1.8rem, 2.2vw, 2.4rem);
}

.brand-logo-login {
  width: min(220px, 100%);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.alert-error {
  background: rgba(195, 60, 84, 0.12);
  color: #8a1732;
}

.alert-warning {
  background: rgba(215, 156, 22, 0.16);
  color: #875803;
}

.card-note {
  margin-top: 14px;
}

[data-panel-region="logs-results"][aria-busy="true"],
[data-panel-region="dashboard-core"][aria-busy="true"] {
  opacity: 0.72;
  transition: opacity 0.18s ease;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 1100px) {

  .two-column,
  .filters-grid,
  .payload-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .panel-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-bottom: 16px;
  }

  .brand-sidebar {
    justify-items: center;
  }

  .brand-copy {
    justify-items: center;
  }

  .brand-copy strong {
    max-width: none;
    text-align: center;
  }

  .content {
    padding: 20px;
  }

  .page-header,
  .detail-header {
    flex-direction: column;
  }

  .status-grid,
  .stats-grid,
  .detail-summary-grid {
    grid-template-columns: 1fr;
  }

  .panel-modal-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 20px;
  }

  .panel-modal-content {
    padding: 16px;
  }
}
