/* Shared chrome for SOVET product mockups */
@import url("/static/tokens.css");

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: var(--topbar) 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.app.dark {
  background: var(--navy);
  color: var(--bg);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px 0 18px;
  background: var(--navy);
  color: var(--bg);
  border-bottom: 1px solid var(--line-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--navy) 35%, transparent 36%),
    conic-gradient(from 0deg, var(--teal), var(--blue), var(--teal));
  box-shadow: inset 0 0 0 2px var(--teal);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 8px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 2px var(--teal);
}
.brand-name {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 14px;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.top-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy-2);
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}
.top-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--bg);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--mono);
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid rgba(15,163,177,.35);
}
.pill.warn { background: rgba(212,160,23,.15); color: #E6C35A; border-color: rgba(212,160,23,.35); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: white;
}

.sidebar {
  background: var(--navy-2);
  color: var(--light);
  border-right: 1px solid var(--line-dark);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px 12px 8px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--light);
  font-size: 13.5px;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.04); }
.nav-item.active {
  background: var(--teal-dim);
  color: white;
  box-shadow: inset 3px 0 0 var(--teal);
}
.nav-ico {
  width: 18px; height: 18px; opacity: 0.9;
  display: grid; place-items: center;
  font-size: 12px;
}
.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line-dark);
  font-size: 12px;
  color: var(--muted);
}

.main {
  padding: 20px 24px 28px;
  overflow: auto;
  background: var(--bg);
}
.app.dark .main { background: #071324; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-kicker {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--teal);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.page-title { margin: 0; font-size: 24px; font-weight: 700; color: var(--navy); }
.app.dark .page-title { color: var(--bg); }
.page-desc { margin: 6px 0 0; color: var(--body); font-size: 14px; max-width: 640px; }
.app.dark .page-desc { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--teal); color: var(--navy); }
.btn-secondary { background: white; color: var(--navy); border: 1px solid var(--line); }
.app.dark .btn-secondary { background: var(--navy-3); color: var(--bg); border-color: var(--line-dark); }
.btn-ghost { background: transparent; color: var(--body); border: 1px solid var(--line); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.4fr 1fr; }
.grid-main { grid-template-columns: 1.6fr 1fr; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.app.dark .card {
  background: var(--navy-2);
  border-color: var(--line-dark);
  box-shadow: none;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 14px; font-weight: 700; margin: 0; }
.card-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-delta { margin-top: 8px; font-size: 12px; color: var(--success); font-family: var(--mono); }
.kpi-delta.down { color: var(--danger); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-family: var(--mono); font-size: 11px;
  color: var(--muted); font-weight: 500; padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.app.dark .table th { border-color: var(--line-dark); }
.table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--body);
}
.app.dark .table td { border-color: var(--line-dark); color: var(--light); }
.table tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-family: var(--mono);
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge.ok { background: rgba(31,169,122,.12); color: var(--success); }
.badge.run { background: var(--blue-dim); color: var(--blue); }
.badge.wait { background: rgba(212,160,23,.15); color: var(--warn); }
.badge.off { background: rgba(143,163,189,.15); color: var(--muted); }

/* Graph / orchestration */
.graph {
  position: relative;
  height: 360px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 20% 30%, rgba(15,163,177,.08), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(46,91,230,.08), transparent 42%),
    linear-gradient(180deg, #fbfdff, #f3f6fa);
  border: 1px dashed #d7e0ea;
  overflow: hidden;
}
.app.dark .graph {
  background:
    radial-gradient(circle at 20% 30%, rgba(15,163,177,.12), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(46,91,230,.12), transparent 42%),
    linear-gradient(180deg, #0b1a31, #091526);
  border-color: var(--line-dark);
}
.node {
  position: absolute;
  min-width: 128px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 6px 18px rgba(10,27,51,.08);
}
.app.dark .node {
  background: var(--navy-3);
  border-color: var(--line-dark);
  box-shadow: none;
}
.node.core {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}
.node-title { font-size: 12px; font-weight: 700; }
.node-sub { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.edge {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  opacity: 0.55;
  transform-origin: left center;
}

.list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.app.dark .list-row { border-color: var(--line-dark); }
.list-row:last-child { border-bottom: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.app.dark .tabs { border-color: var(--line-dark); }
.tab {
  padding: 10px 14px; font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer;
}
.tab.active { color: var(--navy); border-color: var(--teal); font-weight: 600; }
.app.dark .tab.active { color: var(--bg); }

/* IDE layout */
.ide {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  grid-template-rows: var(--topbar) 1fr 160px;
  height: 100vh;
  background: #0B1526;
  color: #D7E3F4;
  font-size: 13px;
}
.ide-top {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: #0A1B33;
  border-bottom: 1px solid #1E3355;
}
.ide-left, .ide-right, .ide-editor, .ide-bottom {
  border-color: #1E3355;
}
.ide-left { border-right: 1px solid #1E3355; background: #0C1E38; padding: 10px; overflow: auto; }
.ide-right { border-left: 1px solid #1E3355; background: #0C1E38; padding: 10px; overflow: auto; }
.ide-editor { background: #081526; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ide-bottom { grid-column: 1 / -1; border-top: 1px solid #1E3355; background: #091624; padding: 8px 12px; overflow: auto; }
.file {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; color: #A9BCD6; cursor: pointer;
}
.file.active, .file:hover { background: rgba(15,163,177,.12); color: white; }
.tabs-editor {
  display: flex; gap: 2px; background: #0A1B33; border-bottom: 1px solid #1E3355; padding: 0 8px;
}
.etab {
  padding: 9px 14px; color: #8FA3BD; border-right: 1px solid #1E3355;
}
.etab.active { background: #081526; color: white; border-top: 2px solid var(--teal); }
.code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 14px 0;
  margin: 0;
  white-space: pre;
  overflow: auto;
  flex: 1;
}
.ln { display: inline-block; width: 42px; text-align: right; color: #4A607C; margin-right: 14px; user-select: none; }
.kw { color: #7EB6FF; }
.str { color: #8BD9B0; }
.cmt { color: #5B708C; }
.fn { color: #0FA3B1; }
.num { color: #E6C35A; }

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