.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.button--primary {
  background: var(--accent-gradient);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 28px var(--blue-shadow);
}

.button--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.28);
}

.button--ghost {
  border-color: var(--accent);
  background: transparent;
  color: var(--text-muted);
}

.button--ghost:hover {
  background: rgba(37, 99, 235, 0.14);
  color: #ffffff;
}

.button--danger {
  border-color: rgba(255, 59, 59, 0.35);
  background: rgba(255, 59, 59, 0.08);
  color: #ff9c9c;
}

.button--small {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
}

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

.textarea {
  min-height: 120px;
  padding-block: 12px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-dim);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #0a0e1a;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 800;
}

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--text-primary);
}

.card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.panel__header h2,
.panel__header h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0;
}

.panel__body {
  padding: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--text-dim);
}

.dot--healthy,
.dot--connected,
.badge--success .dot {
  background: var(--success);
  box-shadow: 0 0 16px rgba(0, 245, 160, 0.7);
}

.dot--degraded,
.badge--warning .dot {
  background: var(--warning);
  box-shadow: 0 0 16px rgba(255, 184, 0, 0.55);
}

.dot--down,
.dot--failed,
.badge--error .dot {
  background: var(--error);
  box-shadow: 0 0 16px rgba(255, 59, 59, 0.55);
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 6vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
}

.stat small {
  display: block;
  margin-top: 10px;
  color: var(--text-dim);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

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

.table th {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.toast[data-kind="success"] {
  border-color: rgba(0, 245, 160, 0.35);
}

.toast[data-kind="warning"] {
  border-color: rgba(255, 184, 0, 0.45);
}

.toast[data-kind="error"] {
  border-color: rgba(255, 59, 59, 0.45);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 14, 0.74);
}

.modal[aria-hidden="false"] {
  display: grid;
}

.modal__dialog {
  width: min(100%, 520px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.modal__head h2 {
  margin: 0;
  font-family: var(--font-display);
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
}

.modal__body {
  padding: 18px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

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

@media (max-width: 640px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  .panel__header {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    flex: 1 1 180px;
  }
}
