:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-2: #0a1322;
  --panel: #101b2e;
  --panel-2: #0b1526;
  --panel-3: #0a1220;
  --row: rgba(5, 10, 20, 0.54);
  --line: rgba(169, 190, 230, 0.15);
  --line-strong: rgba(169, 190, 230, 0.24);
  --text: #dce3ee;
  --heading: #e6eaf2;
  --muted: rgba(220, 227, 238, 0.66);
  --soft: rgba(220, 227, 238, 0.45);
  --green: #2ee58a;
  --amber: #ffbc42;
  --red: #ff6674;
  --blue: #55a2ff;
  --green-bg: rgba(46, 229, 138, 0.10);
  --amber-bg: rgba(255, 188, 66, 0.10);
  --red-bg: rgba(255, 102, 116, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Assistant", "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(180deg, #0b1424 0%, #07101d 46%, #050a14 100%);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.58;
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

p,
span,
th,
td,
label,
small,
em {
  color: var(--muted);
  font-weight: 400;
}

button {
  min-height: 34px;
  border: 1px solid rgba(85, 162, 255, 0.34);
  border-radius: 7px;
  color: var(--heading);
  background: linear-gradient(180deg, rgba(85, 162, 255, 0.22), rgba(85, 162, 255, 0.07));
  cursor: pointer;
  font-weight: 500;
  padding: 0 12px;
}

button:hover {
  border-color: rgba(85, 162, 255, 0.58);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

button.danger,
.ops-actions .stop-action {
  border-color: rgba(255, 102, 116, 0.46);
  background: linear-gradient(180deg, rgba(255, 102, 116, 0.26), rgba(255, 102, 116, 0.08));
  color: #ffe5e8;
}

input,
select {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(4, 9, 18, 0.82);
  color: var(--text);
  padding: 0 10px;
  font-weight: 400;
}

.ops-shell {
  width: min(1560px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.ops-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.ops-title-block {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.ops-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ops-title-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(85, 162, 255, 0.28);
  border-radius: 8px;
  color: #d8ecff;
  background: rgba(85, 162, 255, 0.10);
  font-size: 14px;
  font-weight: 600;
}

h1 {
  color: var(--heading);
  font-size: 25px;
  line-height: 1.18;
  font-weight: 700;
}

h2 {
  color: rgba(220, 227, 238, 0.78);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

h3 {
  color: rgba(220, 227, 238, 0.76);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

#host-line {
  margin-top: 3px;
  font-size: 12px;
}

.ops-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ops-meta-strip span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(4, 9, 18, 0.45);
  padding: 0 9px;
}

.ops-meta-strip b {
  color: var(--soft);
  font-size: 10px;
  font-weight: 400;
}

.ops-meta-strip em {
  color: var(--text);
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
}

.ops-auth,
.upload-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#session-user {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(4, 9, 18, 0.38);
}

.ops-error {
  border: 1px solid rgba(255, 102, 116, 0.42);
  background: rgba(255, 102, 116, 0.12);
  color: #ffe2e5;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.ops-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 9px;
}

.ops-panel,
.status-card,
.ops-login,
.info-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 27, 46, 0.96), rgba(9, 18, 33, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 38px rgba(0, 0, 0, 0.24);
}

.status-card {
  --accent: var(--amber);
  min-height: 104px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
}

.status-card.is-ok { --accent: var(--green); }
.status-card.is-warn { --accent: var(--amber); }
.status-card.is-bad { --accent: var(--red); }

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: color-mix(in srgb, var(--accent) 72%, var(--heading));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 15px;
  font-weight: 500;
}

.card-head span:last-child {
  color: rgba(220, 227, 238, 0.70);
  font-weight: 400;
}

.status-card strong {
  color: var(--heading);
  font-size: 25px;
  line-height: 1.14;
  font-weight: 600;
}

.status-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(220, 227, 238, 0.48);
  font-size: 11px;
  line-height: 1.45;
}

.health-bar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.health-item {
  min-height: 34px;
  display: grid;
  grid-template-columns: 10px minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 9, 18, 0.42);
  padding: 0 9px;
}

.health-item i,
.status-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(255, 188, 66, 0.45);
}

.health-item.is-ok i,
.status-dot.is-ok {
  background: var(--green);
  box-shadow: 0 0 12px rgba(46, 229, 138, 0.46);
}

.health-item.is-warn i,
.status-dot.is-warn {
  background: var(--amber);
  box-shadow: 0 0 12px rgba(255, 188, 66, 0.45);
}

.health-item.is-bad i,
.status-dot.is-bad {
  background: var(--red);
  box-shadow: 0 0 12px rgba(255, 102, 116, 0.45);
}

.health-item b {
  color: rgba(220, 227, 238, 0.78);
  font-size: 11px;
  font-weight: 500;
}

.health-item em {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
}

.ops-main-tabs,
.log-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ops-main-tabs {
  margin-bottom: 10px;
}

.ops-main-tabs button,
.log-tabs button {
  min-height: 32px;
  border-color: var(--line);
  background: rgba(4, 9, 18, 0.48);
  color: var(--muted);
  font-weight: 400;
  padding-inline: 13px;
}

.ops-main-tabs button.active,
.log-tabs button.active {
  color: var(--heading);
  border-color: rgba(85, 162, 255, 0.46);
  background: linear-gradient(180deg, rgba(85, 162, 255, 0.22), rgba(85, 162, 255, 0.08));
  font-weight: 400;
}

.tab-panel {
  display: none;
  margin-bottom: 9px;
}

.tab-panel.active {
  display: block;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 9px;
}

.ops-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 9px;
}

.ops-side-stack {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

.ops-panel,
.ops-login {
  padding: 12px;
  min-width: 0;
}

.ops-login {
  width: min(420px, 100%);
  margin: 76px auto 0;
  padding: 18px;
}

.ops-login h2 {
  margin-bottom: 12px;
  font-size: 20px;
}

.panel-head {
  min-height: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.logs-head {
  align-items: flex-start;
}

.table-wrap {
  overflow-x: hidden;
  overflow-y: visible;
  border: 1px solid rgba(169, 190, 230, 0.10);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 8px 7px;
  border-bottom: 1px solid rgba(169, 190, 230, 0.10);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.55;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(11, 21, 38, 0.98);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

td {
  color: var(--text);
}

td span,
td small {
  font-size: 10.5px;
}

th:nth-child(1), td:nth-child(1) { width: 34px; text-align: center; }
th:nth-child(2), td:nth-child(2) { width: 72px; }
th:nth-child(3), td:nth-child(3) { width: 148px; }
th:nth-child(4), td:nth-child(4) { width: 112px; }
th:nth-child(5), td:nth-child(5) { width: 76px; }
th:nth-child(6), td:nth-child(6) { width: 120px; }
th:nth-child(7), td:nth-child(7) { width: 50px; }
th:nth-child(8), td:nth-child(8) { width: 66px; }
th:nth-child(9), td:nth-child(9) { width: 48px; }
th:nth-child(10), td:nth-child(10) { width: 82px; }
th:nth-child(11), td:nth-child(11) { width: 54px; }
th:nth-child(12), td:nth-child(12) { width: 180px; }

.tenant-name {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--heading);
  font-size: 14px;
  font-weight: 600;
}

.tenant-link,
.overview-row a {
  color: #9fc8ff;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.tenant-link:hover,
.tenant-link:focus-visible,
.overview-row a:hover {
  color: var(--heading);
  outline: none;
  text-decoration-style: solid;
}

.tenant-link::after {
  content: "↗";
  display: inline-block;
  margin-inline-start: 5px;
  font-size: 11px;
  opacity: 0.78;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--amber);
  background: var(--amber-bg);
  font-size: 12px;
  font-weight: 500;
}

.pill.ok {
  color: var(--green);
  background: var(--green-bg);
}

.pill.warn {
  color: var(--amber);
  background: var(--amber-bg);
}

.pill.bad {
  color: var(--red);
  background: var(--red-bg);
}

.pill.legacy {
  color: var(--blue);
  background: rgba(85, 162, 255, 0.13);
}

.overview-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid rgba(169, 190, 230, 0.10);
  border-radius: 8px;
  background: var(--row);
  padding: 7px 9px;
}

.overview-row + .overview-row {
  margin-top: 7px;
}

.overview-row strong,
.overview-row small,
.overview-row a {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-row strong {
  color: var(--heading);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.overview-row small {
  font-size: 11px;
  line-height: 1.45;
}

.ops-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

.ops-actions button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 500;
}

.ops-form {
  display: grid;
  gap: 10px;
  margin: 11px 0 0;
}

.ops-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.create-tenant-card {
  border-color: rgba(85, 162, 255, 0.21);
}

.primary-action {
  min-height: 38px;
  border-color: rgba(46, 229, 138, 0.38);
  background: linear-gradient(180deg, rgba(46, 229, 138, 0.22), rgba(46, 229, 138, 0.08));
}

.progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(169, 190, 230, 0.14);
}

.progress i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.ops-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.info-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 92px;
  padding: 12px;
}

.info-card.is-ok {
  border-color: rgba(46, 229, 138, 0.18);
}

.info-card.is-warn {
  border-color: rgba(255, 188, 66, 0.18);
}

.info-card.is-bad {
  border-color: rgba(255, 102, 116, 0.20);
}

.info-card strong,
.info-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-card strong {
  margin-top: 7px;
  color: var(--heading);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.info-card small {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.5;
}

.logs-panel {
  margin-top: 9px;
}

pre {
  max-height: 330px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(169, 190, 230, 0.10);
  border-radius: 8px;
  background: rgba(4, 9, 18, 0.82);
  color: #cbd8ef;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.62;
}

.empty-state {
  min-height: 80px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(169, 190, 230, 0.14);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(4, 9, 18, 0.34);
}

[dir="ltr"] {
  direction: ltr;
  unicode-bidi: plaintext;
}

@media (max-width: 1280px) {
  .ops-cards,
  .health-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ops-grid,
  .ops-overview-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .ops-shell {
    width: min(100% - 14px, 1560px);
    padding-top: 8px;
  }

  .ops-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .ops-auth {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .ops-cards,
  .health-bar,
  .ops-info-grid {
    grid-template-columns: 1fr;
  }

  .health-item {
    grid-template-columns: 10px 70px minmax(0, 1fr);
  }

  .logs-head {
    display: grid;
    justify-content: stretch;
  }
}
