:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-strong: #e8edf4;
  --text: #111827;
  --muted: #667085;
  --line: #d7dde7;
  --line-soft: #e8edf3;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --blue: #1d4ed8;
  --amber: #a16207;
  --danger: #b42318;
  --ok: #027a48;
  --shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fafc 0, var(--bg) 360px);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

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

button {
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 24px;
  background: #111827;
  color: #fff;
  border-right: 1px solid #243044;
}

.brand-block {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 13px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid #2d394d;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-soft);
  color: #134e4a;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, .18);
}

.brand-block h1,
.topbar h2,
.dialog-card h2 {
  margin: 0;
}

.brand-block h1 {
  font-size: 19px;
  line-height: 1.18;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #a7b4c7;
}

.tabs {
  display: grid;
  gap: 6px;
}

.tab {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 13px;
  background: transparent;
  color: #dbe4ef;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.tab.active,
.tab:hover {
  border-color: #3a4b64;
  background: #1f2937;
  color: #ffffff;
}

.tab.active {
  box-shadow: inset 3px 0 0 var(--brand-soft);
}

.server-box {
  margin-top: auto;
  border: 1px solid #34445b;
  border-radius: 8px;
  padding: 16px;
  background: #1f2937;
}

.server-box span,
.server-box small {
  display: block;
  color: #a7b4c7;
}

.server-box strong {
  display: block;
  margin: 8px 0;
  color: #99f6e4;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow);
}

.topbar h2 {
  font-size: 24px;
  line-height: 1.22;
}

.top-actions,
.actions,
.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.primary-button {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 20px rgba(15, 118, 110, .18);
}

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

.ghost-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}

.ghost-button:hover {
  background: var(--surface-soft);
}

.danger-button {
  background: #fff1f0;
  color: var(--danger);
}

.danger-button:hover {
  background: #fee4e2;
}

.primary-button:active,
.ghost-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel,
.table-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 112px;
  padding: 17px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.12;
}

.board {
  display: grid;
  gap: 14px;
}

.one-page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.one-page-intro h3,
.one-page-intro p {
  margin: 0;
}

.one-page-intro h3 {
  font-size: 20px;
  line-height: 1.25;
}

.one-page-intro p {
  margin-top: 6px;
  max-width: 820px;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: 14px;
}

.module-overview {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.module-card {
  min-height: 118px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease;
}

.module-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.module-card span,
.module-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.module-card strong {
  display: block;
  margin: 10px 0 6px;
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.chart-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.bar-chart {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bar-label strong {
  color: var(--text);
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 0;
}

.section-title h3,
.section-title p {
  margin: 0;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.panel h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.panel p {
  color: var(--muted);
  line-height: 1.45;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-soft);
}

.stage span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stage strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
  line-height: 1.1;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.list-item strong,
.list-item span {
  display: block;
}

.list-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.table-card {
  overflow: hidden;
}

.one-page-modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.module-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.module-section-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
  cursor: pointer;
  list-style: none;
}

.module-section-summary::-webkit-details-marker {
  display: none;
}

.module-section-summary::after {
  content: "+";
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
}

.module-section[open] .module-section-summary::after {
  content: "-";
}

.module-section-summary h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.module-section-summary h3 span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.module-section-body {
  border-top: 1px solid var(--line-soft);
}

.module-section-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 15px 0;
}

.module-table-wrap {
  overflow-x: auto;
}

.module-table th,
.module-table td {
  padding: 12px;
}

.module-table .inline-actions {
  justify-content: flex-end;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
}

.search-box {
  max-width: 320px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

td {
  color: #263445;
  font-size: 14px;
}

tr:hover td {
  background: #fbfcfe;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e8f1ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

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

.badge.warn {
  background: #fef0c7;
  color: var(--amber);
}

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

dialog {
  width: min(680px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .24);
}

dialog::backdrop {
  background: rgba(15, 23, 42, .58);
}

.dialog-card {
  padding: 22px;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin: 20px 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

@media (max-width: 980px) {
  .app-shell,
  .dashboard-grid,
  .one-page-modules,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .module-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .metrics,
  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .tabs,
  .metrics,
  .pipeline,
  .module-overview {
    grid-template-columns: 1fr;
  }

  .topbar,
  .table-toolbar,
  .one-page-intro,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .inline-actions {
    flex-wrap: wrap;
  }

  .metric strong {
    font-size: 24px;
  }

  .table-card {
    overflow-x: auto;
  }
}
