:root {
  --rail: #f97316;
  --rail-dark: #9a3412;
  --ink: #15171a;
  --muted: #667085;
  --line: #d7dde5;
  --surface: #f6f8fb;
  --panel: #ffffff;
  --ok: #138a48;
  --warn: #b7791f;
  --danger: #c2413b;
  --zynex: #1d4ed8;
  --helena: #7c3aed;
  --nexus: #047857;
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 72px 1fr;
}

.live-rail {
  background: var(--rail);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 10px;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.rail-mark {
  width: 42px;
  height: 42px;
  border: 2px solid #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
}

.rail-button {
  width: 44px;
  height: 44px;
  border: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.16);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
}

.rail-button:hover,
.rail-button.active {
  background: var(--rail-dark);
}

.rail-spacer {
  flex: 1;
}

.rail-status {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  background: var(--ok);
}

.app {
  min-width: 0;
}

.topbar {
  min-height: 68px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
}

.title-block h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0;
}

.title-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.icon-button,
.command-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 650;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.command-button.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

a.command-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.workspace {
  padding: 20px 24px 28px;
}

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

.grid.kpi {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.grid.main {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  margin-top: 14px;
}

.panel,
.metric,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.panel {
  padding: 16px;
}

.metric {
  padding: 14px;
  min-height: 104px;
}

.metric span,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 750;
}

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

.metric small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--ok);
}

.dot.warn {
  background: var(--warn);
}

.dot.danger {
  background: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.flow {
  display: grid;
  gap: 8px;
}

.flow-step {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.step-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--surface);
  font-weight: 800;
}

.console {
  background: #111827;
  color: #d1fae5;
  min-height: 214px;
  padding: 14px;
  font-family: Consolas, monospace;
  font-size: 12px;
  overflow: auto;
  border-radius: 4px;
}

.console.compact {
  min-height: 126px;
  margin-top: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.product-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.product-tab {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 700;
}

.product-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.app-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
}

.app-hero h2 {
  font-size: 24px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.action-tile {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.action-tile.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.action-tile strong,
.action-tile span {
  display: block;
}

.action-tile strong {
  font-size: 14px;
}

.action-tile span {
  margin-top: 7px;
  color: inherit;
  opacity: 0.78;
  font-size: 12px;
  line-height: 1.35;
}

.app-feed {
  display: grid;
  gap: 10px;
}

.feed-row {
  display: grid;
  grid-template-columns: 42px 1fr 38px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.feed-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.feed-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.helena-box {
  display: grid;
  gap: 10px;
}

.helena-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.module-card {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.module-card.locked {
  background: #f3f4f6;
  color: #6b7280;
}

.module-card strong,
.module-card span,
.module-card small {
  display: block;
}

.module-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.module-card small {
  font-weight: 750;
  text-transform: uppercase;
  font-size: 11px;
}

.profile-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.profile-header h2 {
  margin: 0;
  font-size: 18px;
}

.profile-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.domain-list {
  display: grid;
  gap: 8px;
}

.domain-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.domain-row strong {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

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

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 58px 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .workspace {
    padding: 16px;
  }

  .grid.kpi,
  .grid.main,
  .split,
  .profile-header,
  .quick-actions,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .live-rail {
    padding-inline: 7px;
  }
}
