:root {
  --bg: #071019;
  --bg-deep: #04090f;
  --panel: rgba(11, 19, 28, 0.78);
  --panel-strong: rgba(13, 22, 33, 0.92);
  --line: rgba(208, 223, 241, 0.12);
  --line-strong: rgba(208, 223, 241, 0.18);
  --text: #f1f7ff;
  --muted: #9eb2c5;
  --ok: #45cf8f;
  --ok-soft: rgba(69, 207, 143, 0.14);
  --watch: #ffc35f;
  --watch-soft: rgba(255, 195, 95, 0.14);
  --danger: #ff7676;
  --danger-soft: rgba(255, 118, 118, 0.14);
  --info: #6bafff;
  --info-soft: rgba(107, 175, 255, 0.14);
  --muted-soft: rgba(158, 178, 197, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --max-width: 1280px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(107, 175, 255, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(69, 207, 143, 0.1), transparent 18%),
    linear-gradient(180deg, #061019 0%, #04090f 55%, #06121b 100%);
}

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

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6,
strong {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

.page-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(56px);
  opacity: 0.45;
  pointer-events: none;
}

.page-glow-a {
  top: 28px;
  left: -40px;
  width: 260px;
  height: 260px;
  background: rgba(107, 175, 255, 0.18);
}

.page-glow-b {
  top: 120px;
  right: -40px;
  width: 220px;
  height: 220px;
  background: rgba(69, 207, 143, 0.12);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 16px 14px 56px;
}

.dashboard,
.stack,
.hero-grid,
.metrics-grid,
.action-list,
.clients-list,
.activity-grid,
.components-grid,
.detail-stack,
.client-chip-grid,
.client-summary-grid,
.kv-grid {
  display: grid;
  gap: 16px;
}

.panel,
.metric-card,
.action-card,
.activity-card,
.client-card,
.component-card,
.detail-block,
.history-card,
.summary-card,
.empty-state {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    linear-gradient(180deg, rgba(12, 21, 31, 0.84), rgba(9, 15, 24, 0.92));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.panel::before,
.metric-card::before,
.action-card::before,
.activity-card::before,
.client-card::before,
.component-card::before,
.detail-block::before,
.history-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 28%);
  pointer-events: none;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 18px;
}

.panel-hero {
  min-height: 100%;
}

.topbar {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid rgba(208, 223, 241, 0.12);
  background: #f6f7f8;
  padding: 6px;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.topbar-copy,
.section-copy,
.support-copy,
.empty-copy,
.history-head p,
.component-cause,
.signal-meta,
.metric-card p,
.activity-card p,
.action-card p,
.summary-title,
.mini-list span {
  color: var(--muted);
}

.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.meta {
  display: grid;
  gap: 10px;
}

.meta-pair {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.meta-pair strong {
  color: var(--text);
}

.section-header,
.global-card-head,
.action-card-head,
.client-card-head,
.component-card-head,
.detail-block-head,
.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.section-header,
.detail-block-head {
  margin-bottom: 10px;
}

.hero-grid {
  align-items: start;
}

.global-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    rgba(7, 13, 21, 0.5);
}

.global-main-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.global-main-line p {
  font-size: 1rem;
  line-height: 1.45;
}

.signal-lamp {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.signal-lamp.is-ok {
  background: var(--ok);
  border-color: rgba(69, 207, 143, 0.45);
  box-shadow: 0 0 16px rgba(69, 207, 143, 0.52);
}

.signal-lamp.is-watch {
  background: var(--watch);
  border-color: rgba(255, 195, 95, 0.45);
  box-shadow: 0 0 16px rgba(255, 195, 95, 0.44);
}

.signal-lamp.is-danger {
  background: var(--danger);
  border-color: rgba(255, 118, 118, 0.45);
  box-shadow: 0 0 16px rgba(255, 118, 118, 0.5);
}

.signal-copy {
  font-size: 1rem;
  line-height: 1.4;
}

.summary-pills,
.chip-row,
.history-caption {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-chip,
.priority-pill,
.text-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.82rem;
}

.status-chip.is-ok,
.tone-ok {
  background: var(--ok-soft);
  border-color: rgba(69, 207, 143, 0.22);
}

.status-chip.is-watch,
.tone-watch {
  background: var(--watch-soft);
  border-color: rgba(255, 195, 95, 0.22);
}

.status-chip.is-danger,
.tone-danger {
  background: var(--danger-soft);
  border-color: rgba(255, 118, 118, 0.22);
}

.status-chip.is-info,
.tone-info,
.priority-pill,
.chip-link {
  background: var(--info-soft);
  border-color: rgba(107, 175, 255, 0.22);
}

.status-chip.is-muted,
.tone-muted,
.text-chip {
  background: var(--muted-soft);
  border-color: rgba(158, 178, 197, 0.18);
}

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

.metric-card,
.activity-card,
.action-card,
.component-card,
.detail-block,
.summary-card,
.empty-state {
  border-radius: var(--radius-md);
  padding: 16px;
}

.metric-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 1.68rem;
}

.clients-list {
  align-content: start;
}

.client-card {
  border-radius: 24px;
  padding: 18px;
  display: grid;
  gap: 16px;
  border-color: rgba(208, 223, 241, 0.12);
}

.client-signal {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

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

.client-chip {
  display: flex;
  align-items: center;
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 23, 0.54);
}

.client-chip-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.client-chip-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.priority-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.84rem;
}

.priority-human {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 23, 0.64);
  color: var(--text);
}

.priority-code {
  font-size: 0.74rem;
  color: var(--muted);
}

.client-chip-label,
.component-label {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.component-lamp {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.component-lamp.is-ok {
  background: var(--ok);
  border-color: rgba(69, 207, 143, 0.45);
  box-shadow: 0 0 14px rgba(69, 207, 143, 0.46);
}

.component-lamp.is-watch,
.component-lamp.is-info {
  background: var(--watch);
  border-color: rgba(255, 195, 95, 0.45);
  box-shadow: 0 0 14px rgba(255, 195, 95, 0.42);
}

.component-lamp.is-danger {
  background: var(--danger);
  border-color: rgba(255, 118, 118, 0.45);
  box-shadow: 0 0 14px rgba(255, 118, 118, 0.44);
}

.component-lamp.is-muted {
  background: rgba(158, 178, 197, 0.55);
  border-color: rgba(158, 178, 197, 0.28);
}

.client-detail {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.client-detail > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.client-detail > summary::-webkit-details-marker {
  display: none;
}

.detail-stack {
  margin-top: 16px;
}

.detail-block {
  display: grid;
  gap: 14px;
}

.client-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.summary-card {
  background: rgba(8, 13, 20, 0.52);
  border: 1px solid var(--line);
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
}

.components-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.component-card {
  gap: 14px;
}

.component-card h5 {
  font-size: 1.08rem;
  line-height: 1.25;
}

.component-card-head {
  margin-bottom: 4px;
}

.kv-grid,
.duration-block {
  display: grid;
  gap: 10px;
}

.duration-block {
  padding-top: 6px;
  border-top: 1px solid rgba(208, 223, 241, 0.08);
}

.kv-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: 0.92rem;
  color: var(--muted);
}

.kv-line strong {
  text-align: right;
  color: var(--text);
  font-size: 0.92rem;
}

.command-list {
  display: grid;
  gap: 10px;
}

.command-code {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(107, 175, 255, 0.2);
  background: rgba(7, 13, 21, 0.86);
  color: #d8ecff;
  font: 0.9rem/1.4 "IBM Plex Mono", "SFMono-Regular", monospace;
  overflow-x: auto;
}

.history-card {
  display: grid;
  gap: 12px;
  border-radius: 16px;
  padding: 14px;
  background: rgba(7, 12, 20, 0.58);
  border: 1px solid rgba(208, 223, 241, 0.1);
}

.history-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: rgba(5, 9, 14, 0.46);
}

.history-caption {
  font-size: 0.84rem;
  color: var(--muted);
}

.mini-list {
  display: grid;
  gap: 8px;
}

.empty-state {
  border-style: dashed;
  background: rgba(9, 14, 22, 0.44);
}

.empty-state h3 {
  margin-bottom: 6px;
}

.inline-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.tone-ok {
  border-color: rgba(69, 207, 143, 0.22);
}

.tone-watch {
  border-color: rgba(255, 195, 95, 0.22);
}

.tone-danger {
  border-color: rgba(255, 118, 118, 0.22);
}

.tone-info {
  border-color: rgba(107, 175, 255, 0.22);
}

.tone-muted {
  border-color: rgba(158, 178, 197, 0.18);
}

@media (min-width: 760px) {
  .app-shell {
    padding: 24px 22px 60px;
  }

  .topbar {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
  }

  .hero-grid {
    grid-template-columns: 1.3fr 1fr;
  }

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

  .client-chip-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
