:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --line: #dde4ea;
  --text: #17232f;
  --muted: #667585;
  --brand: #114b5f;
  --brand-soft: #e3eef2;
  --accent: #d97706;
  --accent-soft: #fff1db;
  --ok: #15803d;
  --ok-soft: #e9f8ed;
  --warn: #a16207;
  --warn-soft: #fef3c7;
  --danger: #c2410c;
  --danger-soft: #fff1eb;
  --shadow: 0 14px 40px rgba(23, 35, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(17, 75, 95, 0.08), transparent 26%),
    linear-gradient(180deg, #f9fbfc 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 18px;
}

.sidebar,
.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 1.3rem;
}

.brand small {
  color: var(--muted);
}

.nav {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  text-align: left;
  padding: 13px 14px;
  border-radius: 16px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  border-color: var(--line);
}

.nav-item.active {
  background: var(--brand);
  color: white;
}

.sidebar-note {
  margin-top: 20px;
  padding: 14px;
  border-radius: 18px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.92rem;
  line-height: 1.5;
}

.workspace {
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: 1.85rem;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.content {
  padding: 22px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.stats-grid,
.dashboard-grid,
.split-grid,
.form-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 18px;
}

.dashboard-grid,
.split-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 18px;
}

.stat-card,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  margin: 6px 0 4px;
}

.stat-card small {
  color: var(--muted);
}

.card {
  padding: 18px;
}

.card-header,
.section-intro {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-header h2,
.card-header h3,
.section-intro h2 {
  margin: 0;
}

.card-header p,
.section-intro p {
  margin: 4px 0 0;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge-info {
  background: var(--brand-soft);
  color: var(--brand);
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.stack-list,
.flow-list {
  display: grid;
  gap: 12px;
}

.stack-item,
.flow-step,
.info-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.stack-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.stack-item strong {
  display: block;
  margin-bottom: 4px;
}

.stack-item small {
  color: var(--muted);
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button,
.button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.mini-button {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.button {
  border-radius: 14px;
  padding: 11px 15px;
}

.button-primary {
  background: var(--brand);
  color: white;
}

.button-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.flow-step {
  display: flex;
  gap: 12px;
}

.flow-step span {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

.field.full,
.form-actions.full {
  grid-column: span 2;
}

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

.field input,
.field select,
.field textarea {
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.empty-state {
  color: var(--muted);
  padding: 8px 2px;
}

.info-box strong {
  display: block;
  margin-bottom: 6px;
}

.info-box p {
  margin: 0;
  color: var(--muted);
}

.hidden-note {
  display: none;
  margin-bottom: 14px;
}

@media (max-width: 1180px) {
  .app-shell,
  .stats-grid,
  .dashboard-grid,
  .split-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full,
  .form-actions.full {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
  }

  .sidebar,
  .workspace {
    border-radius: 22px;
  }

  .content,
  .topbar {
    padding: 16px;
  }
}
