:root {
  --ink: #091014;
  --muted: #657075;
  --soft: #f5f7f7;
  --surface: #ffffff;
  --line: #dce2e4;
  --line-strong: #cbd3d6;
  --nav: #020708;
  --nav-2: #071115;
  --teal: #16c8d7;
  --teal-strong: #00bcd1;
  --teal-soft: #e9fbfd;
  --green: #13a85a;
  --red: #d73d3d;
  --shadow: 0 20px 45px rgba(12, 25, 31, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--ink);
  background: var(--soft);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
}

[hidden] {
  display: none !important;
}

button,
a {
  font: inherit;
}

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

button {
  border: 0;
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-shell {
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
}

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 6;
  display: flex;
  width: 86px;
  flex-direction: column;
  align-items: center;
  color: rgba(247, 252, 252, 0.74);
  background: linear-gradient(180deg, var(--nav), #071319 58%, #020708);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.side-nav__brand {
  display: grid;
  width: 86px;
  height: 78px;
  place-items: center;
}

.snoaper-mark {
  display: grid;
  width: 38px;
  height: 36px;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  transform: rotate(-28deg);
}

.snoaper-mark span {
  border-radius: 2px;
  background: var(--teal);
  box-shadow: 0 0 18px rgba(22, 200, 215, 0.28);
}

.snoaper-mark span:nth-child(2n) {
  transform: translateY(6px);
}

.snoaper-mark--large {
  width: 52px;
  height: 50px;
}

.side-nav__links {
  display: grid;
  width: 100%;
  gap: 8px;
  padding-top: 28px;
}

.side-nav__link {
  position: relative;
  display: grid;
  width: 86px;
  height: 68px;
  place-items: center;
  color: currentColor;
  background: transparent;
}

.side-nav__link svg {
  width: 29px;
  height: 29px;
  stroke-width: 1.8;
}

.side-nav__link--active {
  color: var(--teal);
  background: rgba(255, 255, 255, 0.07);
}

.side-nav__link--active::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--teal);
}

.side-nav__link:hover,
.side-nav__link:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.side-nav__exit {
  margin-top: auto;
  margin-bottom: 20px;
}

.workspace {
  min-height: 100vh;
  padding-left: 86px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px 0 38px;
  color: #f8fbfa;
  background: rgba(2, 7, 8, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.admin-title {
  color: #ffffff;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.auth-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  color: rgba(248, 251, 250, 0.88);
  font-size: 0.98rem;
  font-weight: 560;
}

.microsoft-mark {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.microsoft-mark span:nth-child(1) {
  background: #f25022;
}

.microsoft-mark span:nth-child(2) {
  background: #7fba00;
}

.microsoft-mark span:nth-child(3) {
  background: #00a4ef;
}

.microsoft-mark span:nth-child(4) {
  background: #ffb900;
}

.topbar-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: #f8fbfa;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  font-size: 0.95rem;
  font-weight: 720;
}

.topbar-button:hover,
.topbar-button:focus-visible {
  border-color: var(--teal);
}

.topbar-button:disabled,
.auth-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.topbar-button--ghost {
  color: rgba(248, 251, 250, 0.76);
}

.admin-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 400px);
  min-height: calc(100vh - 78px);
}

.overview-pane {
  min-width: 0;
  padding: 34px 44px 54px 38px;
}

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

.section-head--tight {
  margin-bottom: 16px;
}

.section-head h1,
.section-head h2 {
  margin: 0;
  color: var(--ink);
  font-weight: 820;
  line-height: 1.05;
}

.section-head h1 {
  font-size: 2rem;
}

.section-head h2 {
  font-size: 1.65rem;
}

.section-head p {
  max-width: 640px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 520;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 34px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.metric-card {
  min-height: 188px;
  padding: 30px 30px 24px;
  border-right: 1px solid var(--line);
}

.metric-card:last-child {
  border-right: 0;
}

.metric-card__label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.metric-card__value {
  display: block;
  margin-top: 18px;
  color: var(--ink);
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  font-weight: 820;
  line-height: 1;
}

.metric-card__value[data-tone="up"] {
  color: var(--green);
}

.metric-card__value[data-tone="down"] {
  color: var(--red);
}

.sparkline {
  width: 100%;
  height: 38px;
  margin-top: 25px;
  color: var(--teal);
}

.sparkline polyline {
  vector-effect: non-scaling-stroke;
}

.projects-section {
  padding-top: 4px;
}

.demo-section {
  margin-top: 38px;
  padding-top: 2px;
}

.demo-section__head {
  align-items: center;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.9;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--teal-strong);
  border-color: var(--teal-strong);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.demo-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.demo-metric {
  min-height: 132px;
  padding: 24px 22px;
  border-right: 1px solid var(--line);
}

.demo-metric:last-child {
  border-right: 0;
}

.demo-metric__label {
  display: block;
  min-height: 42px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
}

.demo-metric__value {
  display: block;
  margin-top: 20px;
  color: var(--ink);
  font-size: clamp(1.65rem, 2.2vw, 2.25rem);
  font-weight: 830;
  line-height: 1;
}

.demo-breakdowns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
  margin-top: 20px;
}

.breakdown-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.breakdown-panel h3 {
  margin: 0;
  padding: 18px 20px;
  color: var(--ink);
  background: #fbfcfc;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
  font-weight: 820;
}

.breakdown-list {
  display: grid;
}

.breakdown-row {
  display: grid;
  min-height: 74px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

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

.breakdown-row__place {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.breakdown-row__place span:first-child {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 780;
}

.breakdown-row__place span + span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 640;
}

.breakdown-row__metric {
  display: grid;
  min-width: 96px;
  gap: 3px;
  justify-items: end;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.breakdown-row__metric strong {
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 830;
}

.breakdown-empty {
  margin: 0;
  padding: 20px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 640;
}

#demo-traffic-status[data-state="error"] {
  color: var(--red);
}

.project-table {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.project-header,
.project-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) minmax(108px, 0.72fr) minmax(108px, 0.72fr) minmax(108px, 0.72fr) minmax(132px, 0.72fr) 34px;
  align-items: center;
}

.project-header {
  min-height: 50px;
  padding: 0 22px;
  color: var(--muted);
  background: #fbfcfc;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 700;
}

.project-row {
  width: 100%;
  min-height: 118px;
  padding: 0 22px;
  color: var(--ink);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

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

.project-row:hover,
.project-row:focus-visible {
  background: #fbfefe;
}

.project-row[aria-selected="true"] {
  position: relative;
  z-index: 1;
  background: linear-gradient(90deg, rgba(22, 200, 215, 0.12), rgba(255, 255, 255, 0.96));
  box-shadow: inset 0 0 0 2px var(--teal-strong);
}

.project-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 22px;
}

.brand-tile {
  display: grid;
  width: 74px;
  height: 74px;
  flex: 0 0 74px;
  place-items: center;
  color: var(--teal-strong);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 8px 22px rgba(10, 24, 30, 0.06);
}

.brand-tile svg {
  width: 52px;
  height: 52px;
}

.brand-tile--portfolio {
  color: #111719;
}

.project-name {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.15;
}

.project-meta {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 620;
}

.money,
.net {
  font-size: 0.96rem;
  font-weight: 680;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.98rem;
  font-weight: 800;
}

.trend[data-tone="up"] {
  color: var(--green);
}

.trend[data-tone="down"] {
  color: var(--red);
}

.trend[data-tone="flat"] {
  color: #6e777c;
}

.row-arrow {
  justify-self: end;
  color: #606a70;
  font-size: 2rem;
  line-height: 1;
}

.detail-panel {
  position: sticky;
  top: 78px;
  align-self: start;
  min-height: calc(100vh - 78px);
  padding: 50px 26px 36px;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: -16px 0 34px rgba(10, 24, 30, 0.06);
}

.detail-close {
  position: absolute;
  top: 22px;
  right: 22px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #808a90;
  background: transparent;
  border-radius: 5px;
}

.detail-close svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.detail-close:hover,
.detail-close:focus-visible {
  color: var(--ink);
  background: var(--soft);
}

.detail-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.8rem;
  font-weight: 830;
  line-height: 1.05;
}

.detail-status {
  margin: 8px 40px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.detail-logo {
  display: grid;
  min-height: 214px;
  place-items: center;
  margin: 34px 0 28px;
}

.detail-logo--compact {
  min-height: 128px;
  margin: 24px 0 20px;
}

.detail-logo .brand-tile {
  width: 156px;
  height: 156px;
  box-shadow: none;
}

.detail-logo--compact .brand-tile {
  width: 104px;
  height: 104px;
}

.detail-logo .brand-tile svg {
  width: 116px;
  height: 116px;
}

.detail-logo--compact .brand-tile svg {
  width: 76px;
  height: 76px;
}

.detail-divider {
  height: 1px;
  margin: 0 0 26px;
  background: var(--line);
}

.detail-block {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-block__head {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-block__head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 820;
}

.detail-block__head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
  text-align: right;
}

.detail-metrics {
  display: grid;
}

.detail-row {
  display: grid;
  min-height: 72px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-row__icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #7a848a;
  border: 1px solid #aeb8bd;
  border-radius: 50%;
}

.detail-row__icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.detail-row__label {
  color: #677177;
  font-size: 0.96rem;
  font-weight: 650;
}

.detail-row__value {
  color: #7a848a;
  overflow-wrap: anywhere;
  font-size: 1.18rem;
  font-weight: 780;
  text-align: right;
}

.detail-row__value[data-tone="up"] {
  color: var(--green);
}

.detail-row__value[data-tone="down"] {
  color: var(--red);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(2, 7, 8, 0.74);
  backdrop-filter: blur(12px);
}

.admin-shell[data-auth="signed-in"] .auth-gate {
  display: none;
}

.admin-shell[data-auth="checking"] .auth-gate {
  display: grid;
}

.auth-card {
  width: min(100%, 420px);
  padding: 34px;
  color: #f8fbfa;
  background: #071115;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 26px 0 12px;
  color: #ffffff;
  font-size: 2rem;
  font-weight: 830;
  line-height: 1.05;
}

.auth-card p {
  margin: 0;
  color: rgba(248, 251, 250, 0.76);
  font-size: 1rem;
}

.auth-card__actions {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.auth-button {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 18px;
  color: #f8fbfa;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 760;
}

.auth-button:hover,
.auth-button:focus-visible {
  border-color: var(--teal);
}

.auth-preview {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-size: 0.95rem;
  font-weight: 760;
}

:focus-visible {
  outline: 3px solid #ff866d;
  outline-offset: 3px;
}

@media (max-width: 1180px) {
  .admin-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-panel {
    position: relative;
    top: auto;
    min-height: auto;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
    box-shadow: none;
  }
}

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

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

  .demo-metric {
    border-bottom: 1px solid var(--line);
  }

  .demo-metric:nth-child(2n) {
    border-right: 0;
  }

  .demo-metric:last-child {
    border-bottom: 0;
  }

  .demo-breakdowns {
    grid-template-columns: 1fr;
  }

  .metric-card:nth-child(2) {
    border-right: 0;
  }

  .metric-card:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .project-header {
    display: none;
  }

  .project-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 18px;
  }

  .project-row > :not(.project-identity):not(.row-arrow) {
    display: none;
  }
}

@media (max-width: 720px) {
  .side-nav {
    position: sticky;
    top: 0;
    width: 100%;
    height: 64px;
    flex-direction: row;
    justify-content: space-between;
  }

  .side-nav__brand,
  .side-nav__link {
    width: 64px;
    height: 64px;
  }

  .side-nav__links {
    display: flex;
    width: auto;
    padding: 0;
  }

  .side-nav__exit {
    margin: 0 4px 0 0;
  }

  .workspace {
    padding-left: 0;
  }

  .topbar {
    min-height: 116px;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 18px 20px;
  }

  .auth-status {
    width: 100%;
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-button {
    flex: 1 1 auto;
  }

  .admin-main {
    min-height: calc(100vh - 180px);
  }

  .overview-pane {
    padding: 26px 16px 40px;
  }

  .section-head {
    display: block;
  }

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

  .demo-section__head {
    display: flex;
  }

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

  .demo-metric {
    min-height: 118px;
    border-right: 0;
  }

  .demo-metric__label {
    min-height: auto;
  }

  .breakdown-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .breakdown-row__metric {
    justify-items: start;
  }

  .metric-card {
    min-height: 150px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-card:last-child {
    border-bottom: 0;
  }

  .brand-tile {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
  }

  .brand-tile svg {
    width: 44px;
    height: 44px;
  }

  .project-row {
    min-height: 96px;
  }

  .detail-panel {
    padding: 42px 18px 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
