:root {
  --bg: #10150f;
  --panel: #182118;
  --line: #2c3a2e;
  --text: #eef4ee;
  --muted: #8fa396;
  --accent: #c8f542;
  --danger: #ff5c5c;
  --ok: #3ddc97;
  --warn: #ffb020;
  --radius: 14px;
  font-family: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 0% -10%, #1d2c20 0%, transparent 60%),
    radial-gradient(700px 360px at 100% 0%, #18241c 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100%;
}
body { padding: 14px 12px 48px; }
.app { max-width: 760px; margin: 0 auto; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.brand {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
}
h1 { margin: 4px 0 0; font-size: 26px; font-weight: 700; }
h2 { margin: 0; font-size: 16px; font-weight: 650; }

.pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #101612;
  white-space: nowrap;
}
.pill.run { color: var(--ok); border-color: #245741; }
.pill.pause { color: var(--warn); border-color: #5c4314; }
.pill.idle { color: var(--muted); }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.tab.active {
  background: var(--accent);
  color: #111;
  border-color: transparent;
  font-weight: 700;
}

.page { display: none; }
.page.active { display: block; animation: fade .2s ease; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 10px;
}
.metric .label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}
.metric strong { font-size: 18px; }

.panel {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.danger { background: var(--danger); color: white; }
.btn.tiny { padding: 6px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.muted { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.list li:first-child { border-top: 0; }
.list.stacked li {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.row-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.item-title { font-weight: 650; }
.item-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.tag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.tag.ok { color: var(--ok); border-color: #245741; }
.tag.warn { color: var(--warn); border-color: #5c4314; }
.tag.bad { color: var(--danger); border-color: #6e2626; }

.form { display: grid; gap: 8px; margin-bottom: 4px; }
.integration-list { display: grid; gap: 10px; }
.integration-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #101612;
}
.integration-card .form { margin-top: 10px; }
.form input, .select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #101612;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
.select { width: auto; min-width: 140px; }
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.error {
  background: #3a1515;
  border: 1px solid #6e2626;
  color: #ffc9c9;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 10px;
}
.toast {
  background: #16301f;
  border: 1px solid #2f6b45;
  color: #c9ffe0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 10px;
}
.hidden { display: none; }

.log-view {
  margin: 0;
  max-height: 55vh;
  overflow: auto;
  background: #0b100c;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c7d7cb;
}
.preview-player {
  width: 100%;
  max-height: 62vh;
  margin-top: 4px;
  border-radius: 12px;
  background: #000;
}

@media (max-width: 560px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 22px; }
}
