:root {
  color-scheme: light;
  --bg: #f7f2ea;
  --bg-alt: #efe6dc;
  --card: #ffffff;
  --text: #1d1b1a;
  --muted: #5c5146;
  --primary: #0a6847;
  --primary-dark: #074431;
  --accent: #d36f4c;
  --border: #e3d7c9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at top left, #fbeedb, var(--bg)) fixed;
  color: var(--text);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand__dot {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
}

.brand__title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  margin: 0;
}

.brand__subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.nav a {
  margin-left: 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

.nav a:hover {
  color: var(--primary);
}

.nav__sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--border);
  margin-left: 16px;
  vertical-align: middle;
}

.nav__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  margin-left: 14px;
  vertical-align: middle;
}

.nav__user {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
  vertical-align: middle;
}

.nav__logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted) !important;
  margin-left: 8px !important;
  vertical-align: middle;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav__logout:hover {
  color: #c0392b !important;
  background: #fdecea;
}

.content {
  padding: 32px 48px 64px;
  flex: 1;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 50px rgba(30, 20, 10, 0.08);
}

.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 32px;
  margin-bottom: 12px;
}

.hero__actions {
  display: flex;
  gap: 12px;
}

.cards__toolbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: -8px;
}
.cards__toolbar .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 28px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 14px 30px rgba(40, 22, 10, 0.08);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card__header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
  background: #f8d9c8;
  color: #7b3d1d;
}

.status--ok {
  background: #cbe9d8;
  color: #115c3f;
}

.status--warn {
  background: #f8d9c8;
  color: #7b3d1d;
}

.status--error {
  background: #fdecea;
  color: #c0392b;
}

.health-error {
  font-size: 12px;
  color: #c0392b;
  background: #fdecea;
  padding: 6px 10px;
  border-radius: 8px;
  margin-top: 4px;
  word-break: break-word;
}

.button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button:hover {
  background: var(--primary-dark);
}

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

.button.ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.button--sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
}

.form-wide {
  max-width: 680px;
}

.page-title h1 {
  font-family: "Space Grotesk", sans-serif;
  margin-bottom: 8px;
}

.helper {
  font-size: 13px;
  color: var(--muted);
}

.alerts {
  margin-bottom: 16px;
  display: grid;
  gap: 8px;
}

.alert {
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff4e8;
  border: 1px solid #f2d0b8;
  font-size: 14px;
}

.cards--full {
  grid-template-columns: 1fr;
}

.card--combined {
  border-left: 4px solid var(--primary);
}

.platform-checks {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.platform-checks legend {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 4px;
}

.check-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.check-label input[type="checkbox"]:disabled + span {
  color: var(--muted);
  opacity: 0.5;
}

.endpoints {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.endpoints__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.endpoints__list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.endpoints__list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.endpoints__method {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.endpoints__path {
  font-family: "Space Grotesk", monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

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

.endpoints__item {
  cursor: pointer;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.endpoints__item:hover {
  background: var(--bg-alt);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(29, 27, 26, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 64px rgba(30, 20, 10, 0.18);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal__header h3 {
  font-family: "Space Grotesk", monospace;
  font-size: 14px;
  margin: 0;
  color: var(--primary);
  word-break: break-all;
}

.modal__close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  line-height: 1;
}

.modal__close:hover {
  color: var(--text);
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 24px;
  }

  .content {
    padding: 24px;
  }

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

  .hero__actions {
    flex-direction: column;
    width: 100%;
  }

  .hero__actions .button {
    width: 100%;
  }
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Tab panels ── */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Panel toolbar ── */
.panel-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

/* ── Data table ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #faf6f2;
}

/* ── Cell inputs ── */
.cell-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}

.cell-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.cell-input--sm {
  max-width: 80px;
}

/* ── Delete button ── */
.btn-del {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.btn-del:hover {
  color: #c0392b;
  background: #fdecea;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast--error {
  background: #c0392b;
}

/* ── Spinner ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

/* ── Checking badge ── */
.status--checking {
  background: #eee;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status--checking .spinner {
  width: 10px;
  height: 10px;
  border-width: 1.5px;
}

/* ── Health check modal ── */
.modal--health {
  max-width: 520px;
}

.health-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.health-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg);
  transition: background 0.3s;
}

.health-row--ok {
  background: #eafaf1;
}

.health-row--error {
  background: #fdecea;
}

.health-row--pending {
  background: #fef5e7;
}

.health-row__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.health-row__name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}

.health-row__status {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ── Docs page ── */
.docs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.docs-nav__link {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.docs-nav__link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.docs-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 20px;
  overflow: hidden;
}

.docs-section__header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.docs-section__header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.docs-section__body {
  padding: 20px 24px;
}

.docs-section__body > p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.docs-step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.docs-step:last-child {
  margin-bottom: 0;
}

.docs-step__num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.docs-step h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.docs-step ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
}

.docs-step ol li {
  margin-bottom: 4px;
}

.docs-step p {
  font-size: 13px;
  margin: 0;
  line-height: 1.6;
}

.docs-step a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.docs-step a:hover {
  text-decoration: underline;
}

.docs-note {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fef5e7;
  border-left: 3px solid #f0ad4e;
  font-size: 12px;
  line-height: 1.6;
}

.docs-code {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Space Grotesk', monospace;
  font-size: 12px;
  word-break: break-all;
}

.docs-step code:not(.docs-code) {
  padding: 1px 5px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 12px;
}
