:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #657178;
  --line: #d8e0e3;
  --line-strong: #c6d0d4;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --sidebar: #172127;
  --sidebar-hover: #243239;
  --sidebar-muted: #aab7bd;
  --teal: #087f78;
  --teal-dark: #05645f;
  --green: #176c49;
  --blue: #215f88;
  --amber: #8a5b0a;
  --danger: #a02626;
  --focus: #0069c2;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

a {
  color: inherit;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.35;
}

.app-shell {
  overflow-x: hidden;
}

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

.app-sidebar {
  height: 100vh;
  min-width: 0;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  color: #ffffff;
  background: var(--sidebar);
  border-right: 1px solid #2d3b42;
}

.sidebar-brand,
.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-brand {
  min-height: 46px;
  padding: 0 8px;
}

.brand-mark {
  width: 42px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  background: var(--teal);
  border-radius: 5px;
  font-size: 12px;
}

.brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 15px;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 500;
}

.app-navigation {
  display: grid;
  gap: 4px;
  margin-top: 30px;
}

.app-nav-link {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d5dde0;
  border-left: 3px solid transparent;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.app-nav-link:hover {
  color: #ffffff;
  background: var(--sidebar-hover);
}

.app-nav-link.is-active {
  color: #ffffff;
  background: #20383a;
  border-left-color: #2fb4a9;
}

.app-nav-link .dx-icon {
  width: 18px;
  color: var(--sidebar-muted);
  font-size: 17px;
  text-align: center;
}

.app-nav-link.is-active .dx-icon {
  color: #5fd0c6;
}

.sidebar-footer {
  margin-top: auto;
  padding: 15px 12px 4px;
  display: flex;
  flex-direction: column;
  color: var(--sidebar-muted);
  border-top: 1px solid #344148;
  font-size: 11px;
}

.sidebar-footer strong {
  margin-top: 4px;
  color: #ffffff;
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
}

.app-workspace {
  min-width: 0;
}

.app-topbar {
  height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
}

.topbar-context {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar-context span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.topbar-context strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.account-menu form {
  margin: 0;
}

.account-name {
  max-width: 240px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-state {
  min-height: 26px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  background: #edf7f1;
  border: 1px solid #c2dfcf;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.connection-state i,
.status-online i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--green);
  border-radius: 50%;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--ink);
  background: #f3f6f7;
}

.icon-button .dx-icon {
  font-size: 17px;
}

.nav-toggle {
  display: none;
}

.sidebar-overlay {
  display: none;
}

.page-frame {
  width: 100%;
  padding: 28px 32px 56px;
}

.page-frame > main {
  width: min(100%, 1380px);
  margin: 0 auto;
}

.page-heading,
.section-heading,
.split-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.page-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status {
  min-height: 28px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.status-online {
  color: var(--green);
  background: #edf7f1;
  border: 1px solid #c2dfcf;
}

.status-neutral {
  color: #536168;
  background: #f1f4f5;
  border: 1px solid var(--line);
}

.metric-strip {
  min-height: 124px;
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.metric-strip-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-item {
  min-width: 0;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.metric-item:last-child {
  border-right: 0;
}

.metric-item > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-item strong {
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 26px;
  line-height: 1.2;
}

.metric-item .metric-text {
  font-size: 17px;
}

.metric-item small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.dashboard-rail {
  min-width: 0;
}

.workspace-section {
  min-width: 0;
  margin-top: 20px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.compact-section {
  padding: 20px;
}

.section-copy {
  margin: 10px 0 15px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.text-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.text-action:hover {
  text-decoration: underline;
}

.text-action .dx-icon {
  font-size: 11px;
}

.runs-section,
.table-section {
  overflow: hidden;
}

.rpm-grid {
  width: 100%;
  min-height: 282px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.rpm-grid-full {
  min-height: 460px;
}

.grid-fallback {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.rpm-grid .dx-datagrid {
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
}

.rpm-grid .dx-datagrid-headers {
  color: #526067;
  background: #f7f9f9;
  border-bottom-color: var(--line);
}

.rpm-grid .dx-datagrid-headers .dx-datagrid-table .dx-row > td {
  padding-top: 10px;
  padding-bottom: 10px;
  font-weight: 700;
}

.rpm-grid .dx-datagrid-rowsview {
  border-bottom: 0;
}

.rpm-grid .dx-datagrid-nodata {
  color: var(--muted);
  font-size: 13px;
}

.operational-list,
.service-list {
  margin: 17px 0 0;
}

.operational-list div,
.service-list div {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.operational-list div:last-child,
.service-list div:last-child {
  border-bottom: 0;
}

.operational-list dt,
.service-list dt {
  color: var(--muted);
  font-weight: 500;
}

.operational-list dd,
.service-list dd {
  margin: 0;
  font-weight: 700;
}

.service-list dt {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.service-list .dx-icon {
  width: 18px;
  color: var(--blue);
  text-align: center;
}

.service-ok {
  color: var(--green);
}

.definition-list {
  min-width: min(100%, 500px);
  margin: 0;
}

.definition-list-wide {
  min-width: 100%;
  margin-top: 16px;
}

.definition-list div {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.definition-list div:last-child {
  border-bottom: 0;
}

.definition-list dt {
  color: var(--muted);
  font-weight: 500;
}

.definition-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.system-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.empty-state {
  min-height: 180px;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  text-align: center;
}

.empty-state .dx-icon {
  margin-bottom: 6px;
  color: #7d8d94;
  font-size: 25px;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state span {
  font-size: 13px;
}

.button {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 700;
  cursor: pointer;
}

.button-primary {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

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

.button:focus-visible,
.icon-button:focus-visible,
.app-nav-link:focus-visible,
input:focus-visible,
.text-action:focus-visible {
  outline: 3px solid rgba(0, 105, 194, 0.28);
  outline-offset: 1px;
}

.auth-shell .page-frame {
  width: 100%;
  min-height: 100vh;
  padding: 0;
  display: grid;
  place-items: center;
}

.auth-shell main {
  width: 100%;
}

.login-wrap {
  width: min(420px, calc(100% - 32px));
  margin: 0 auto;
}

.login-brand {
  margin-bottom: 18px;
  color: var(--ink);
}

.login-panel {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 35px rgba(24, 42, 50, 0.09);
}

.login-panel h1 {
  margin-bottom: 24px;
}

.field-group {
  margin-bottom: 17px;
}

.field-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
}

.field-group input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #aeb9be;
  border-radius: 5px;
}

.field-group span,
.validation-summary {
  display: block;
  margin-top: 5px;
  color: var(--danger);
  font-size: 13px;
}

.validation-summary:empty {
  display: none;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
}

.login-submit {
  width: 100%;
}

@media (max-width: 1100px) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .account-name {
    max-width: 170px;
  }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-sidebar {
    width: 248px;
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }

  .sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    width: 100%;
    height: 100%;
    padding: 0;
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    visibility: hidden;
    opacity: 0;
    background: rgba(14, 24, 29, 0.42);
    border: 0;
    transition: opacity 160ms ease, visibility 160ms ease;
  }

  .sidebar-open .sidebar-overlay {
    visibility: visible;
    opacity: 1;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .dashboard-layout,
  .system-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .metric-item:nth-child(2) {
    border-right: 0;
  }

  .metric-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .metric-strip-three .metric-item:nth-child(2) {
    border-right: 1px solid var(--line);
  }

  .metric-strip-three .metric-item:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .split-section {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .app-topbar {
    height: 58px;
    padding: 0 14px;
  }

  .topbar-context span,
  .connection-state,
  .account-name {
    display: none;
  }

  .account-menu {
    gap: 8px;
  }

  .page-frame {
    padding: 20px 14px 42px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .metric-item {
    padding: 17px;
  }

  .workspace-section {
    padding: 18px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .definition-list {
    min-width: 100%;
  }

  .definition-list div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

@media (max-width: 420px) {
  .metric-strip,
  .metric-strip-three {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-item,
  .metric-strip-three .metric-item:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-item:last-child,
  .metric-strip-three .metric-item:last-child {
    grid-column: auto;
    border-bottom: 0;
  }

  .metric-strip-three .metric-item:last-child {
    border-top: 0;
  }

  .login-panel {
    padding: 23px;
  }
}
