:root {
  --bg: #07111f;
  --bg-soft: #0b1727;
  --panel: #0f1d2f;
  --panel-2: #12233a;
  --line: rgba(255,255,255,.08);
  --text: #f4f8ff;
  --muted: #8fa1b9;
  --primary: #23b8ff;
  --primary-2: #0f8ed0;
  --success: #31d08b;
  --danger: #ff627d;
  --warning: #ffb648;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0,0,0,.28);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    linear-gradient(
      145deg,
      #37c8ff,
      #087bc6
    );
  box-shadow:
    0 12px 35px rgba(35,184,255,.28);
  color: white;
  font-size: 25px;
  font-weight: 900;
}

.brand-mark.small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 19px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(35,184,255,.14),
      transparent 40%
    ),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    rgba(15,29,47,.95);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 18px 0 8px;
  font-size: 30px;
}

.login-card form {
  margin-top: 28px;
}

label {
  display: block;
  margin-bottom: 9px;
  color: #c9d4e5;
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255,255,255,.035);
  color: var(--text);
  transition: .2s ease;
}

input:focus {
  border-color:
    rgba(35,184,255,.7);
  box-shadow:
    0 0 0 3px rgba(35,184,255,.10);
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 15px;
  font-weight: 800;
  transition: .18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-2)
    );
  color: white;
}

.btn.secondary {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--text);
}

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

.btn.danger {
  background:
    rgba(255,98,125,.12);
  color: #ff8da0;
}

.btn.full {
  width: 100%;
  margin-top: 16px;
}

.form-error {
  margin: 12px 0 0;
  color: #ff8da0;
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px 1fr;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #081422;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 25px;
}

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

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

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

.nav-item {
  width: 100%;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 750;
}

.nav-item:hover,
.nav-item.active {
  background:
    rgba(35,184,255,.09);
  color: var(--text);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.sidebar-bottom {
  margin-top: auto;
}

.environment {
  margin-bottom: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 12px;
}

.status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--success);
  box-shadow:
    0 0 0 4px rgba(49,208,139,.10);
}

.main {
  grid-column: 2;
  min-width: 0;
  padding: 28px 30px 60px;
}

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

.topbar h2 {
  margin: 5px 0 0;
  font-size: 27px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.metric-grid {
  margin-bottom: 22px;
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0,1fr));
  gap: 15px;
}

.metric-card {
  min-height: 150px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(
      145deg,
      rgba(18,35,58,.96),
      rgba(12,25,42,.96)
    );
}

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

.metric-card strong {
  margin: 16px 0 5px;
  font-size: 38px;
  line-height: 1;
}

.metric-card small {
  margin-top: auto;
  color: #71849d;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.panel-header {
  padding: 19px 21px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.org-row {
  padding: 17px 21px;
  display: grid;
  grid-template-columns:
    minmax(180px,1.4fr)
    minmax(130px,.8fr)
    minmax(150px,.9fr)
    auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.org-row:last-child {
  border-bottom: 0;
}

.org-row:hover {
  background: rgba(255,255,255,.02);
}

.org-name {
  font-weight: 800;
}

.org-slug {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.org-meta {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge.connected {
  color: #64e5a7;
  background: rgba(49,208,139,.12);
}

.badge.error {
  color: #ff8da0;
  background: rgba(255,98,125,.12);
}

.badge.pending {
  color: #ffd07b;
  background: rgba(255,182,72,.12);
}

.badge.none {
  color: var(--muted);
  background: rgba(255,255,255,.05);
}

.empty {
  padding: 45px 20px;
  color: var(--muted);
  text-align: center;
}

.drawer {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  width: min(520px, 96vw);
  height: 100vh;
  transform: translateX(105%);
  transition:
    transform .25s ease;
  border-left: 1px solid var(--line);
  background: #0a1727;
  box-shadow:
    -20px 0 60px rgba(0,0,0,.32);
}

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

.drawer-header,
.modal-header {
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.drawer-header h3,
.modal-header h3 {
  margin: 5px 0 0;
}

.drawer-body {
  height: calc(100vh - 83px);
  padding: 22px;
  overflow: auto;
}

.detail-section {
  margin-bottom: 26px;
}

.detail-section h4 {
  margin: 0 0 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-box {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}

.detail-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.detail-box strong {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  word-break: break-word;
}

.form-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}

.field {
  margin-bottom: 14px;
}

.form-actions {
  display: flex;
  gap: 9px;
  margin-top: 15px;
}

.backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: rgba(2,8,15,.72);
  backdrop-filter: blur(4px);
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 23px;
}

.modal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  pointer-events: none;
}

.modal-card {
  width: min(500px,100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #0d1b2d;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.modal-card form {
  padding: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.toast {
  position: fixed;
  z-index: 60;
  right: 24px;
  bottom: 24px;
  max-width: 380px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #13243a;
  box-shadow: var(--shadow);
}

.toast.error {
  border-color:
    rgba(255,98,125,.35);
}

.toast.success {
  border-color:
    rgba(49,208,139,.35);
}

@media (max-width: 1000px) {
  .metric-grid {
    grid-template-columns:
      repeat(2,1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .sidebar-bottom {
    display: none;
  }

  .main {
    padding: 20px 15px 50px;
  }

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

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

  .org-row {
    grid-template-columns: 1fr;
  }
}

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

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1;
  }
}
