:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #d9e2ec;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px;
  background: #0f172a;
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

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

.brand span,
.session-box span {
  color: #cbd5e1;
  font-size: 13px;
}

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

.nav-item,
.session-box button,
.refresh-btn,
.login-form button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
}

.nav-item {
  padding: 0 12px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #1e293b;
  color: #ffffff;
}

.session-box {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.session-box button {
  background: #334155;
  color: #ffffff;
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.api-status,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.api-status.ok,
.badge.active {
  background: #dcfce7;
  color: var(--ok);
}

.api-status.error,
.badge.suspended {
  background: #fee2e2;
  color: var(--danger);
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 160px);
}

.login-form {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.login-form input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

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

.login-form button,
.refresh-btn {
  padding: 0 14px;
  background: var(--primary);
  color: #ffffff;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.workspace {
  display: grid;
  gap: 20px;
}

.hidden {
  display: none !important;
}

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

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

.metric {
  min-height: 118px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

td {
  font-size: 14px;
}

.role {
  font-weight: 850;
}

.role.system_admin {
  color: var(--primary-dark);
}

.role.owner {
  color: #1d4ed8;
}

.role.member {
  color: var(--warn);
}

.log-list {
  display: grid;
  max-height: 390px;
  overflow: auto;
}

.log-item {
  display: grid;
  gap: 4px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.log-item strong {
  font-size: 14px;
}

.log-item span {
  color: var(--muted);
  font-size: 12px;
}

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

  .sidebar {
    position: static;
  }

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

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

@media (max-width: 640px) {
  .content {
    padding: 16px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .split,
  .nav {
    grid-template-columns: 1fr;
  }
}
