:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --accent: #0f766e;
  --sidebar: #0b1220;
  --font: "Manrope", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; }
a { color: inherit; text-decoration: none; }

.demo-bar {
  display: flex; justify-content: space-between;
  padding: 0.55rem 1.2rem; background: #020617; color: #e2e8f0; font-size: 0.82rem;
}
.demo-bar a { color: #5eead4; font-weight: 700; }

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 38px);
}
.sidebar {
  background: var(--sidebar);
  color: #e2e8f0;
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.brand { font-weight: 800; letter-spacing: -0.03em; font-size: 1.2rem; padding: 0 0.5rem; }
#nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-btn {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: transparent;
  color: #94a3b8;
  font-weight: 600;
}
.nav-btn:hover, .nav-btn.is-active {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.side-foot { margin-top: auto; padding: 0.75rem; color: #64748b; font-size: 0.8rem; }

.workspace { padding: 1.4rem clamp(1rem, 3vw, 2rem) 2rem; }
.workspace.is-compact .panel { padding: 0.85rem; }
.workspace.is-compact .item { padding: 0.5rem 0.6rem; }
.bar {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end;
  margin-bottom: 1.2rem;
}
.muted { margin: 0; color: var(--muted); font-size: 0.85rem; }
.bar h1 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  letter-spacing: -0.03em;
  font-weight: 800;
}
.bar-actions { display: flex; gap: 0.55rem; }
.ghost, .primary {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0.55rem 1rem; border-radius: 10px; font-weight: 700;
}
.ghost { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.primary { background: var(--ink); color: #fff; }

.view { display: none; }
.view.is-active { display: block; animation: fade 0.22s ease; }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.kpis article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem 1.2rem;
}
.kpis span { color: var(--muted); font-size: 0.85rem; }
.kpis strong {
  display: block; margin: 0.35rem 0; font-size: 1.8rem; letter-spacing: -0.03em;
}
.kpis em { font-style: normal; color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.kpis em.warn { color: #b45309; }

.split {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 1rem;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.panel-head h2, .settings h2 { margin: 0; font-size: 1.1rem; letter-spacing: -0.02em; }
.linkish {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}
.chip {
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: rgba(15, 118, 110, 0.12); color: var(--accent);
  font-size: 0.75rem; font-weight: 700;
}
.chip.warn { background: rgba(245,158,11,0.18); color: #b45309; }

.activity { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.activity li {
  display: flex; justify-content: space-between; gap: 0.8rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem;
}
.activity span { color: var(--muted); }
.actions-grid { display: grid; gap: 0.55rem; }
.action {
  text-align: left;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-weight: 650;
}
.action:hover { background: #ecfeff; border-color: rgba(15,118,110,0.25); }
.hint { color: var(--muted); font-size: 0.88rem; margin: 0.8rem 0 0; }

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.col {
  background: #f8fafc;
  border-radius: 14px;
  padding: 0.7rem;
  min-height: 280px;
}
.col h3 {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.item {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.item:hover { border-color: rgba(15,118,110,0.35); transform: translateY(-1px); }
.item.active { box-shadow: 0 0 0 2px rgba(15,118,110,0.1); }

.table-panel input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  background: #f8fafc;
  outline: none;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.75rem 0.4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tag {
  display: inline-flex; padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700;
}
.tag.ok { background: rgba(15, 118, 110, 0.12); color: var(--accent); }
.tag.warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.row-btn {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
}

.settings { max-width: 420px; display: grid; gap: 0.9rem; }
.switch, .field {
  display: flex; align-items: center; gap: 0.7rem;
  font-weight: 600;
}
.field { flex-direction: column; align-items: stretch; }
.field input {
  margin-top: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: #f8fafc;
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  background: #0f172a;
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  z-index: 40;
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(92vw, 380px);
  box-shadow: 0 24px 60px rgba(15,23,42,0.25);
}
dialog::backdrop { background: rgba(15,23,42,0.45); }
#add-form { padding: 1.2rem; display: grid; gap: 0.75rem; }
#add-form h3 { margin: 0; }
#add-form label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
#add-form input, #add-form select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
}
.dialog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; overflow-x: auto; }
  #nav { flex-direction: row; }
  .side-foot { display: none; }
  .kpis, .split, .pipeline { grid-template-columns: 1fr; }
}
