:root {
  --bg-top: #f6f8fb;
  --bg-bottom: #e9eef5;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(255, 255, 255, 0.65);
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #64748b;
  --brand: #2563eb;
  --brand-soft: rgba(37, 99, 235, 0.14);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.14);
  --ok: #16a34a;
  --warn: #d97706;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 24px 50px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #ffffff 0%, var(--bg-top) 42%),
    linear-gradient(160deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  font-family: "SF Pro Text", "Avenir Next", "Helvetica Neue", sans-serif;
  line-height: 1.45;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
  font-family: "SF Pro Display", "Avenir Next", "Helvetica Neue", sans-serif;
}

.eyebrow {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(245, 248, 252, 0.86);
  backdrop-filter: blur(16px);
}

nav {
  display: flex;
  gap: 0.55rem;
}

.nav-link {
  display: inline-block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.38rem 0.82rem;
  font-weight: 600;
  transition: 0.2s ease;
}

.nav-link:hover {
  border-color: rgba(37, 99, 235, 0.32);
  background: rgba(255, 255, 255, 0.7);
}

.nav-link.active {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--brand-soft);
  color: #1d4ed8;
}

.meta-block {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.content-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.2rem;
  display: grid;
  gap: 1rem;
}

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

.panel-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.panel,
.metric-card {
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.metric-card h2 {
  font-size: 0.97rem;
  color: var(--ink-soft);
}

.metric-value {
  margin: 0.42rem 0 0;
  font-size: 2rem;
  font-weight: 700;
  color: #1e40af;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.key-value {
  margin: 0;
  display: grid;
  gap: 0.36rem;
}

.key-value div {
  display: flex;
  justify-content: space-between;
  gap: 0.72rem;
  padding: 0.26rem 0;
  border-bottom: 1px dashed rgba(100, 116, 139, 0.26);
}

.key-value dt {
  color: var(--ink-soft);
}

.key-value dd {
  margin: 0;
  text-align: right;
  max-width: 70%;
  overflow-wrap: anywhere;
}

.stack-form,
.filters-grid {
  display: grid;
  gap: 0.62rem;
}

.filters-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.28rem;
}

input,
textarea,
select,
button,
a.btn {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  padding: 0.56rem 0.68rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
}

.button-row,
.filters-actions,
.pagination {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn,
a.btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover,
a.btn:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(255, 255, 255, 0.98);
}

.btn-strong {
  border-color: rgba(37, 99, 235, 0.55);
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

.btn-strong:hover {
  filter: brightness(0.98);
}

.btn-danger {
  border-color: rgba(220, 38, 38, 0.35);
  color: #b91c1c;
  background: var(--danger-soft);
}

.btn-danger:hover {
  border-color: rgba(220, 38, 38, 0.55);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.16rem 0.52rem;
  font-size: 0.75rem;
  background: rgba(22, 163, 74, 0.14);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.28);
}

.badge-warn {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.28);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.74rem;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(148, 163, 184, 0.12);
  color: #334155;
}

.status-green,
.status-ok {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
}

.status-red,
.status-error,
.status-timeout {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.12);
  color: #991b1b;
}

.status-yellow,
.status-locked {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.13);
  color: #92400e;
}

.status-gray,
.status-paused,
.status-starting,
.status-running {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.13);
  color: #1d4ed8;
}

.stop-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.26);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 32px rgba(220, 38, 38, 0.12);
  color: #991b1b;
}

.downloads-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.home-only-layout {
  max-width: 1100px;
  min-height: calc(100vh - 2.4rem);
  display: flex;
  align-items: center;
}

.home-only-layout .home-modules-shell {
  width: 100%;
}

.module-card {
  display: grid;
  gap: 0.6rem;
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.12);
}

.module-card h3 {
  font-size: 1rem;
}

.module-open {
  font-size: 0.85rem;
  color: #1d4ed8;
  font-weight: 600;
}

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

.soon-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.74rem;
  border: 1px solid rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.14);
  color: #92400e;
}

.module-card-disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.module-card-disabled:hover {
  transform: none;
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow);
}

.download-card {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.62);
  padding: 0.75rem;
  display: grid;
  gap: 0.45rem;
}

.download-card h3 {
  font-size: 0.95rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.66);
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.55rem;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(248, 250, 252, 0.92);
  color: var(--ink-soft);
  font-weight: 700;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.focus-row {
  cursor: pointer;
}

.focus-row:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: -3px;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
}

.icon-link:hover {
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
}

.text-link {
  color: #2563eb;
}

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

.subheading {
  margin: 0.9rem 0 0.4rem;
}

.live-region {
  min-height: 1.2rem;
  margin-top: 0.5rem;
  color: #1e3a8a;
  font-weight: 600;
}

.json-box {
  margin: 0;
  max-height: 520px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  padding: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 0.82rem;
}

.clean-list {
  margin: 0;
  padding-left: 1rem;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

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

  .panel-grid-3 {
    grid-template-columns: 1fr;
  }

  .downloads-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 760px) {
  .shell-header {
    position: static;
  }

  .home-only-layout {
    min-height: auto;
    display: block;
  }

  .panel-grid-2,
  .panel-grid-4,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .modules-grid {
    grid-template-columns: 1fr;
  }

  .meta-block {
    width: 100%;
    justify-content: space-between;
  }
}
