:root {
  --bg: #07111f;
  --bg-soft: #0b1728;
  --panel: #101d30;
  --panel-2: #132238;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6f8fb;
  --muted: #9aabc1;
  --accent: #65a8ff;
  --accent-2: #8a7dff;
  --success: #72d6a6;
  --warning: #ffc76c;
  --danger: #ff7f86;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top right, rgba(68, 88, 191, 0.12), transparent 34%), 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,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 252px;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  background: rgba(7, 17, 31, 0.97);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 24px;
}

.brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.lens-ring {
  position: absolute;
  inset: 3px 7px 7px 3px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(101, 168, 255, 0.25);
}

.lens-ring::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 2px;
  right: -10px;
  bottom: 0;
  border-radius: 5px;
  background: var(--accent);
  transform: rotate(45deg);
  transform-origin: left center;
}

.lens-grid {
  position: absolute;
  width: 13px;
  height: 13px;
  left: 10px;
  top: 10px;
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 3px;
  background-image: linear-gradient(rgba(255,255,255,0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.25) 1px, transparent 1px);
  background-size: 5px 5px;
}

.main-nav,
.nav-section {
  display: grid;
  gap: 6px;
}

.nav-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.nav-label {
  padding: 0 12px 7px;
  color: #6f8098;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 0 12px;
  border-radius: 12px;
  color: #a8b6c9;
  font-size: 14px;
  font-weight: 650;
  transition: 160ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(101, 168, 255, 0.16), rgba(138, 125, 255, 0.12));
  box-shadow: inset 0 0 0 1px rgba(101, 168, 255, 0.16);
}

.nav-icon {
  width: 20px;
  color: var(--accent);
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 8px 4px;
}

.environment-badge {
  display: inline-flex;
  padding: 5px 8px;
  border: 1px solid rgba(255, 199, 108, 0.2);
  border-radius: 999px;
  color: var(--warning);
  background: rgba(255, 199, 108, 0.08);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.13em;
}

.product-parent {
  margin-top: 9px;
  color: #6f8098;
  font-size: 10px;
}

.main-content {
  margin-left: 252px;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  padding: 18px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 31, 0.9);
  backdrop-filter: blur(18px);
}

.topbar h1,
.section-heading h2,
.welcome-row h2,
.modal h2 {
  margin: 0;
  letter-spacing: -0.035em;
}

.topbar h1 {
  margin-top: 3px;
  font-size: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.button,
.profile-button,
.mobile-menu,
.modal-close,
.text-button {
  border: 0;
}

.button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
}

.button-primary {
  color: #06101d;
  background: linear-gradient(135deg, #7cb8ff, #90a6ff);
  box-shadow: 0 10px 30px rgba(101, 168, 255, 0.2);
}

.button-primary:hover {
  filter: brightness(1.05);
}

.button-secondary {
  color: #dce5f2;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
}

.button-secondary:hover {
  background: rgba(255,255,255,0.065);
}

.button-small {
  min-height: 36px;
  font-size: 12px;
}

.profile-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #375b86, #514c96);
  font-size: 12px;
  font-weight: 900;
}

.mobile-menu {
  display: none;
  color: #fff;
  background: transparent;
  font-size: 22px;
}

.view {
  display: none;
  padding: 34px;
}

.view.active {
  display: block;
  animation: viewIn 180ms ease;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.welcome-row,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}

.welcome-row h2,
.section-heading h2 {
  font-size: clamp(26px, 3vw, 35px);
}

.muted,
.welcome-row .muted,
.section-heading .muted {
  color: var(--muted);
}

.welcome-row .muted,
.section-heading .muted {
  max-width: 690px;
  margin: 9px 0 0;
  line-height: 1.6;
  font-size: 13px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #bfe8d2;
  border: 1px solid rgba(114, 214, 166, 0.16);
  background: rgba(114, 214, 166, 0.06);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot,
.activity-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(114, 214, 166, 0.5);
}

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

.metric-card,
.panel,
.integration-card,
.settings-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 135px;
  padding: 20px;
  border-radius: 16px;
}

.metric-card::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  right: -40px;
  top: -40px;
  border-radius: 50%;
  background: rgba(101, 168, 255, 0.055);
}

.featured-metric {
  background: linear-gradient(135deg, rgba(101,168,255,0.11), rgba(138,125,255,0.08));
}

.metric-label {
  display: block;
  color: #98a9bf;
  font-size: 11px;
  font-weight: 750;
}

.metric-card strong {
  display: block;
  margin: 12px 0 6px;
  font-size: 33px;
  letter-spacing: -0.05em;
}

.metric-card strong.word-metric {
  margin-top: 17px;
  font-size: 21px;
}

.metric-note {
  color: #798ca5;
  font-size: 10px;
}

.metric-note.positive {
  color: #93d9b5;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  border-radius: var(--radius);
  padding: 22px;
}

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

.panel-heading h3,
.empty-state h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.text-button {
  color: var(--accent);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

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

.empty-state.compact {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 19px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.018);
}

.empty-state.compact strong {
  color: #e7edf7;
  font-size: 13px;
}

.empty-state.compact p {
  margin: 3px 0 0;
  font-size: 11px;
  line-height: 1.5;
}

.empty-state.large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 36px;
  text-align: center;
}

.empty-state.large p {
  max-width: 560px;
  margin: 9px 0 20px;
  line-height: 1.65;
  font-size: 12px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(101,168,255,0.17);
  border-radius: 12px;
  color: var(--accent);
  background: rgba(101,168,255,0.075);
  font-size: 15px;
  font-weight: 900;
}

.empty-state.large .empty-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 15px;
  border-radius: 16px;
  font-size: 22px;
}

.activity-list {
  display: grid;
}

.activity-row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: start;
  gap: 11px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.activity-row:first-child {
  border-top: 0;
}

.activity-row strong {
  font-size: 12px;
}

.activity-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.activity-row time {
  color: #6f8098;
  font-size: 9px;
}

.websites-panel {
  min-height: 410px;
}

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

.integration-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  min-height: 90px;
  padding: 18px;
  border-radius: 15px;
}

.integration-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--accent);
  background: rgba(101,168,255,0.08);
  font-size: 11px;
  font-weight: 900;
}

.integration-card strong {
  display: block;
  font-size: 12px;
}

.integration-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.integration-state {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.integration-state.connected {
  color: #a9e2c5;
  background: rgba(114,214,166,0.09);
}

.integration-state.planned {
  color: #a9b8cc;
  background: rgba(255,255,255,0.05);
}

.settings-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  border-radius: var(--radius);
  padding: 4px 22px;
}

.settings-card > div {
  padding: 19px 16px;
  border-right: 1px solid var(--line);
}

.settings-card > div:last-child {
  border-right: 0;
}

.setting-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.settings-card strong {
  font-size: 12px;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 20px;
  color: var(--text);
  background: #0d1a2c;
  box-shadow: 0 30px 100px rgba(0,0,0,0.55);
}

.modal::backdrop {
  background: rgba(1, 8, 18, 0.72);
  backdrop-filter: blur(8px);
}

.modal form {
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal h2 {
  font-size: 24px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  font-size: 22px;
}

.modal label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: #c9d3e1;
  font-size: 11px;
  font-weight: 750;
}

.modal input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 11px;
  outline: none;
  color: #fff;
  background: rgba(255,255,255,0.035);
}

.modal input:focus {
  border-color: rgba(101,168,255,0.5);
  box-shadow: 0 0 0 3px rgba(101,168,255,0.08);
}

.form-note {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 11px;
  color: #8fa2ba;
  background: rgba(255,255,255,0.025);
  font-size: 10px;
  line-height: 1.6;
}

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

.modal-empty {
  margin-top: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  max-width: 340px;
  padding: 13px 16px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #dfe8f4;
  background: #12233a;
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

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

  .dashboard-grid,
  .integration-grid {
    grid-template-columns: 1fr;
  }

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

  .settings-card > div:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 780px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 25px 0 70px rgba(0,0,0,0.4);
  }

  .sidebar.open {
    transform: none;
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-block;
    margin-right: 12px;
  }

  .topbar {
    justify-content: flex-start;
    padding: 14px 18px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .topbar-actions .button-secondary {
    display: none;
  }

  .view {
    padding: 24px 18px;
  }

  .welcome-row,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .settings-card {
    grid-template-columns: 1fr;
  }

  .settings-card > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-card > div:last-child {
    border-bottom: 0;
  }
}

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

  .topbar h1 {
    font-size: 19px;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar-actions .button-primary {
    padding-inline: 11px;
    font-size: 11px;
  }

  .profile-button {
    display: none;
  }
}
