:root {
  --bg: #0f1412;
  --sidebar: #111815;
  --surface: #18211d;
  --surface-2: #202b25;
  --surface-3: #29372f;
  --line: #3c4d43;
  --line-soft: #2d3b33;
  --text: #f3f7f4;
  --muted: #a8b5ac;
  --accent: #b8ff38;
  --accent-soft: #2f431e;
  --cyan: #52d7ef;
  --green: #77e56b;
  --amber: #ffbd45;
  --red: #ff6868;
  --black: #080b09;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.good {
  color: var(--green) !important;
}

.bad {
  color: var(--red) !important;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at 75% 20%,
      rgba(184,255,56,.08),
      transparent 28%
    ),
    linear-gradient(
      135deg,
      #0c110e,
      #17221b
    );
}

.login-card {
  width: min(460px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 28px 80px #0009;
}

.login-logo {
  display: block;
  width: 170px;
  height: 90px;
  object-fit: contain;
  margin: 0 auto 20px;
  background: #e7ece8;
  padding: 6px;
}

.login-title {
  text-align: center;
}

.login-title h1 {
  margin: 0;
  font-size: 28px;
}

.login-title p {
  margin: 9px 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: #dce4df;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #52645a;
  border-radius: 0;
  outline: none;
  background: #0f1612;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

.primary {
  min-height: 42px;
  border: 1px solid #8fd326;
  border-radius: 0;
  background: var(--accent);
  color: #10170c;
  font-weight: 850;
}

.login-card .primary {
  width: 100%;
  margin-top: 10px;
}

.secondary {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 750;
}

.text-button {
  display: block;
  margin: 18px auto 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.text-button:hover {
  color: var(--accent);
}

.environment-pill {
  width: fit-content;
  margin: 0 auto 20px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}

.environment-pill.production {
  color: var(--green);
}

.environment-pill.demo {
  color: var(--amber);
  border-color: #8f6e2f;
}

.error {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #8f4545;
  background: #3d1b1b;
  color: #ffb6b6;
}

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

.demo-banner {
  position: fixed;
  z-index: 90;
  top: 0;
  left: 255px;
  right: 0;
  min-height: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: #8d5e08;
  color: #fff;
  font-size: 11px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 3px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.brand img {
  width: 56px;
  height: 42px;
  padding: 3px;
  object-fit: contain;
  background: #e3e9e5;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.nav-heading {
  margin: 17px 8px 7px;
  color: #78877e;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .13em;
}

#businessNavigation {
  min-height: 0;
  overflow-y: auto;
  flex: 1;
}

.nav-home,
.nav-item {
  width: 100%;
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 1px 0;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #dce4df;
  text-align: left;
  font-size: 12px;
}

.nav-item {
  justify-content: space-between;
}

.nav-item b {
  min-width: 27px;
  padding: 3px 5px;
  background: #202a25;
  color: var(--muted);
  text-align: center;
  font-size: 9px;
}

.nav-home:hover,
.nav-home.active,
.nav-item:hover,
.nav-item.active {
  border-color: var(--line);
  border-left-color: var(--accent);
  background: var(--surface-2);
  color: #fff;
}

.nav-item.active b {
  color: var(--accent);
}

.nav-icon {
  width: 18px;
  text-align: center;
  color: var(--accent);
}

.technical-navigation {
  flex: none;
}

.sidebar-footer {
  flex: none;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}

.environment-control {
  padding: 9px;
  background: #0c120f;
  border: 1px solid var(--line-soft);
}

.environment-control span,
.environment-control strong {
  display: block;
}

.environment-control span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.environment-control strong {
  margin: 3px 0 7px;
  font-size: 12px;
}

.environment-control button {
  width: 100%;
  min-height: 29px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  color: #dce4df;
  font-size: 10px;
}

.user-card {
  padding: 10px 3px;
}

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

.user-card strong {
  font-size: 12px;
}

.user-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.logout-button {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  color: #e5ebe7;
  font-size: 11px;
}

.main {
  min-width: 0;
  padding: 16px;
}

html[data-environment="demo"] .main {
  padding-top: 46px;
}

.topbar {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  margin-bottom: 12px;
  padding: 4px 3px 14px;
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  margin-bottom: 5px;
  color: #77877e;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  border: 1px solid var(--line);
}

.topbar-status div {
  min-width: 120px;
  padding: 9px 11px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.topbar-status div:last-child {
  border-right: 0;
}

.topbar-status span,
.topbar-status strong {
  display: block;
}

.topbar-status span {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.topbar-status strong {
  margin-top: 4px;
  font-size: 12px;
}

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

.dashboard-status,
.module-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.status-card,
.module-kpis article {
  min-height: 100px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

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

.status-card span,
.module-kpis span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.status-card strong,
.module-kpis strong {
  margin-top: 8px;
  font-size: 24px;
}

.status-card small,
.module-kpis small {
  margin-top: 7px;
  color: #87988e;
  font-size: 10px;
  line-height: 1.35;
}

.section-heading {
  min-height: 52px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 5px 2px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.section-heading > span {
  color: var(--muted);
  font-size: 10px;
}

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

.business-card {
  position: relative;
  min-height: 134px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 3px solid #52655a;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.business-card:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface-2);
}

.business-index {
  position: absolute;
  top: 10px;
  right: 11px;
  color: #5f7066;
  font-size: 10px;
  font-weight: 900;
}

.business-card > strong {
  display: block;
  padding-right: 32px;
  font-size: 16px;
}

.business-card > span {
  display: block;
  margin-top: 8px;
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.business-card footer {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 15px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}

.business-card footer b {
  color: var(--accent);
  font-size: 13px;
}

.business-card footer span {
  color: #829188;
  font-size: 9px;
}

.dashboard-lower {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 4px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.panel-header {
  min-height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.panel-header h2 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.panel-header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.status-list {
  padding: 3px 11px;
}

.status-list div {
  min-height: 43px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

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

.identity-block {
  min-height: 180px;
  display: grid;
  place-content: center;
  text-align: center;
}

.identity-block strong {
  font-size: 20px;
}

.identity-block span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.module-hero {
  min-height: 104px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background:
    linear-gradient(
      100deg,
      var(--surface-2),
      var(--surface)
    );
}

.module-hero h2 {
  margin: 0;
  font-size: 24px;
}

.module-hero p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.module-authority {
  min-width: 135px;
  padding: 10px 13px;
  border-left: 1px solid var(--line);
  text-align: right;
}

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

.module-authority span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.module-authority strong {
  margin-top: 4px;
  color: var(--accent);
  font-size: 25px;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.workflow-strip div {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  background: #131b17;
}

.workflow-strip em {
  color: var(--accent);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}

.workflow-strip span {
  font-size: 10px;
  font-weight: 750;
}

.module-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  align-items: start;
}

.work-list {
  max-height: 58vh;
  overflow: auto;
}

.work-action {
  width: 100%;
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.work-action:hover {
  border-left-color: var(--accent);
  background: var(--surface-2);
}

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

.work-action strong {
  font-size: 11px;
}

.work-action span {
  margin-top: 4px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 8px;
  word-break: break-all;
}

.work-action b {
  min-width: 48px;
  padding: 4px 5px;
  border: 1px solid var(--line);
  color: var(--cyan);
  text-align: center;
  font-size: 8px;
}

.work-action.write b {
  color: var(--amber);
}

.work-action.destructive b {
  color: var(--red);
}

.empty-panel {
  padding: 20px;
  color: var(--muted);
  font-size: 11px;
}

.result-panel {
  scroll-margin-top: 15px;
}

#resultContent {
  min-height: 110px;
}

.loading {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  max-width: 320px;
  padding: 8px 9px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: #cdd8d1;
  font-size: 8px;
  text-transform: uppercase;
}

.structured-json,
.result-error pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #080d0a;
  color: #cce0d3;
  font-size: 10px;
}

.result-error {
  padding: 14px;
  color: #ffc1c1;
}

.result-note {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 9px;
}

.technical-warning {
  display: flex;
  gap: 14px;
  padding: 13px;
  border: 1px solid #85662d;
  background: #34280f;
}

.technical-warning strong {
  color: var(--amber);
}

.technical-warning span {
  color: #d7c89f;
  font-size: 11px;
}

.technical-groups {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 4px;
  align-items: start;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #050806d9;
}

.modal-card {
  width: min(900px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 28px 90px #000b;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.modal-header h2 {
  margin: 6px 0 5px;
  font-size: 20px;
}

.modal-header code {
  color: var(--muted);
  font-size: 9px;
}

.modal-close {
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 25px;
}

.method-badge {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid var(--line);
  color: var(--cyan);
  font-size: 8px;
  font-weight: 900;
}

.method-badge.post,
.method-badge.put,
.method-badge.patch {
  color: var(--amber);
}

.method-badge.delete {
  color: var(--red);
}

#actionForm {
  padding: 15px;
}

.form-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 5px 13px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  margin-bottom: 9px;
  color: #dce5df;
  font-size: 10px;
  font-weight: 750;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex !important;
  align-items: center;
}

.checkbox-field input {
  width: auto;
  min-height: auto;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.form-actions button {
  min-width: 120px;
}

.mobile-menu-button,
.mobile-backdrop {
  display: none;
}


@media (max-width: 1250px) {

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

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

}


@media (max-width: 1000px) {

  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 120;
    left: 0;
    top: 0;
    width: min(88vw, 330px);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }

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

  .mobile-menu-button {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    display: block;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--sidebar);
    color: var(--text);
  }

  .mobile-backdrop {
    position: fixed;
    z-index: 110;
    inset: 0;
    display: block;
    background: #0009;
  }

  .demo-banner {
    left: 0;
  }

  .main {
    padding:
      68px 10px 15px;
  }

  html[data-environment="demo"] .main {
    padding-top: 94px;
  }

  .topbar {
    display: block;
  }

  .topbar-status {
    width: 100%;
    margin-top: 14px;
  }

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

  .module-layout,
  .dashboard-lower,
  .technical-groups {
    grid-template-columns: 1fr;
  }

}


@media (max-width: 620px) {

  .login-card {
    padding: 25px 18px;
  }

  .dashboard-status,
  .module-kpis,
  .business-grid,
  .workflow-strip {
    grid-template-columns: 1fr;
  }

  .business-card {
    min-height: 116px;
  }

  .module-hero {
    display: block;
  }

  .module-authority {
    margin-top: 15px;
    padding: 10px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: left;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .full-width {
    grid-column: auto;
  }

  .demo-banner {
    padding: 5px 8px;
    flex-direction: column;
    gap: 0;
    text-align: center;
  }

}
