:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --panel: #ffffff;
  --panel-subtle: #f9faf7;
  --text: #20231f;
  --muted: #687066;
  --line: #dfe4dc;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --danger: #b42318;
  --warning: #b7791f;
  --ok: #2f7d32;
  --shadow: 0 10px 28px rgba(34, 38, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 650;
}

button:hover {
  background: var(--accent-strong);
}

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

button.secondary {
  background: #e8f2ef;
  color: var(--accent-strong);
}

button.secondary:hover {
  background: #d7ebe7;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

button.ghost:hover {
  background: #eef1eb;
  color: var(--text);
}

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

button.danger:hover {
  background: #ffe1dc;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 15px;
  letter-spacing: 0;
}

.layout {
  padding: 22px clamp(16px, 3vw, 34px) 34px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  max-width: 760px;
  margin: 64px auto 0;
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
}

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

.hidden {
  display: none !important;
}

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

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

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

.metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.metrics span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.metrics strong {
  font-size: 26px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tenant-list,
.detail-panel {
  min-height: 620px;
}

.tenant-list {
  padding: 16px;
}

.detail-panel {
  padding: 20px;
}

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

.filter {
  width: 150px;
}

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

.tenant-row {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 64px;
  background: var(--panel-subtle);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px;
}

.tenant-row:hover,
.tenant-row.active {
  background: #eef7f4;
  border-color: #a8d4cc;
}

.tenant-name {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.tenant-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  background: #eef1eb;
  color: var(--muted);
}

.status-active {
  background: #e8f5e9;
  color: var(--ok);
}

.status-disabled {
  background: #fff7e6;
  color: var(--warning);
}

.status-failed {
  background: #fff1ef;
  color: var(--danger);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.info-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-subtle);
  padding: 14px;
}

dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  margin: 0;
}

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

dd {
  margin: 0;
  font-weight: 700;
}

.limits-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: #fbfcf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
}

.limits-form h3 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.event-rows {
  display: grid;
  gap: 8px;
}

.event-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-subtle);
}

.event-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.event-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.empty-state {
  min-height: 560px;
  display: grid;
  place-content: center;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #20231f;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 10;
}

@media (max-width: 980px) {
  .workspace,
  .detail-grid,
  .metrics,
  .form-grid,
  .limits-form {
    grid-template-columns: 1fr;
  }

  .tenant-list,
  .detail-panel {
    min-height: auto;
  }

  .topbar,
  .detail-head,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .filter {
    width: 100%;
  }
}
