:root {
  --bg: #09111d;
  --bg-2: #0f1b2d;
  --panel: rgba(14, 24, 40, 0.92);
  --panel-2: rgba(18, 33, 54, 0.96);
  --panel-3: rgba(255, 255, 255, 0.04);
  --text: #eef4ff;
  --muted: #91a1ba;
  --line: rgba(163, 188, 224, 0.12);
  --accent: #30c8a4;
  --accent-2: #4f8cff;
  --accent-3: #ff8b5d;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(48, 200, 164, 0.14), transparent 22%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: none; }

input, textarea, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(7, 14, 25, 0.95);
  color: var(--text);
}

textarea { min-height: 120px; resize: vertical; }

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

.sidebar {
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 15, 25, 0.98), rgba(11, 18, 31, 0.96));
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand-lockup strong,
.topbar-title,
.hero-title,
.section-head h2,
.auth-card h1,
.metric-card strong {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.brand-lockup small,
.eyebrow,
.muted,
.tiny,
.table-muted,
.user-kicker {
  color: var(--muted);
}

.sidebar-nav,
.sidebar-footer,
.messages,
.stack-list,
.stack-form,
.form-grid,
.upload-grid,
.trend-list {
  display: grid;
  gap: 12px;
}

.nav-pill {
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
  transition: 140ms ease;
}

.nav-pill.active,
.nav-pill:hover {
  color: var(--text);
  background: linear-gradient(135deg, rgba(48, 200, 164, 0.14), rgba(79, 140, 255, 0.14));
  border: 1px solid rgba(79, 140, 255, 0.18);
}

.user-card,
.message,
.metric-card,
.panel,
.hero,
.auth-card,
.note-card,
.connection-card,
.empty-state,
.check-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.user-card,
.message,
.connection-card,
.note-card,
.check-card,
.empty-state {
  padding: 14px 16px;
  border-radius: 18px;
}

.main-shell {
  padding: 26px;
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-title {
  margin: 6px 0 0;
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 0.92;
}

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

.primary-btn,
.ghost-btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 16px;
}

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

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

.full-width { width: 100%; }

.hero {
  padding: 28px;
  border-radius: 28px;
  display: grid;
  grid-template-columns: 1.45fr 0.95fr;
  gap: 20px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.24), transparent 65%);
  pointer-events: none;
}

.hero-title,
.page-head h1,
.auth-card h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4.2vw, 4.4rem);
  line-height: 0.95;
}

.hero-text {
  max-width: 60ch;
  line-height: 1.75;
}

.hero-panel {
  display: grid;
  gap: 12px;
}

.metric {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-3);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
}

.page-head,
.section-head,
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

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

.metric-card {
  padding: 18px;
  border-radius: 22px;
  display: grid;
  gap: 8px;
}

.metric-card strong {
  font-size: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  align-items: start;
}

.span-2 { grid-column: span 2; }

.panel,
.auth-card {
  padding: 22px;
  border-radius: 24px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}

.status-chip {
  padding: 6px 10px;
  border-radius: 999px;
  color: #d9fff6;
  background: rgba(48, 200, 164, 0.12);
  border: 1px solid rgba(48, 200, 164, 0.18);
}

.trend-list {
  grid-template-columns: 1fr;
}

.note-card {
  position: relative;
  overflow: hidden;
}

.note-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
}

.connection-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  align-items: start;
}

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

.oauth-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 10px;
}

.disabled-link {
  pointer-events: none;
  opacity: 0.55;
}

.upload-grid {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
}

.checkbox-grid {
  display: grid;
  gap: 12px;
  border: none;
  padding: 0;
  margin: 0;
}

.check-card {
  display: flex;
  gap: 10px;
  align-items: center;
}

.check-card input { width: auto; }

label {
  display: grid;
  gap: 6px;
}

.auth-wrap {
  display: grid;
  place-items: center;
  min-height: 70vh;
}

.auth-card {
  width: min(560px, 100%);
}

.inline-stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .hero,
  .dashboard-grid,
  .connection-grid,
  .upload-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}
