:root {
  color-scheme: light;
  --bg: #f1f3f0;
  --surface: #ffffff;
  --surface-soft: #f7f7f4;
  --surface-strong: #e8ebe6;
  --text: #171923;
  --muted: #6b7280;
  --line: #e1e5df;
  --primary: #3267e3;
  --success: #2f9d75;
  --warning: #e2a23c;
  --risk: #ef6b4a;
  --critical: #ea3f82;
  --shadow: 0 16px 38px rgba(23, 25, 35, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  overflow-x: hidden;
}

button,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #171923;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f8fafc;
  color: #111827;
  font-weight: 800;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup span {
  color: #cbd5e1;
  font-size: 0.72rem;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  padding: 9px 10px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #1f2937;
  color: #ffffff;
}

.data-note {
  margin-top: auto;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.data-note p {
  margin: 10px 0 0;
  color: #cbd5e1;
  font-size: 0.7rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.workspace {
  padding: 18px 20px 20px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 2.05rem);
  line-height: 1;
}

h2 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.title-group {
  min-width: 190px;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.header-center span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.header-actions {
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.logout-button {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 7px 10px;
}

.header-actions strong,
.header-actions span {
  display: block;
}

.header-actions span {
  color: var(--muted);
  font-size: 0.74rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(18, 128, 92, 0.16);
  flex: 0 0 auto;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(135px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.filter-control {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.filter-control span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.filter-control select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.kpi-card {
  min-height: 86px;
  display: grid;
  align-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
  font-size: 0.68rem;
}

.kpi-card strong {
  font-size: clamp(1.2rem, 1.65vw, 1.55rem);
}

.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kpi-label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.kpi-card.good .kpi-label i {
  background: var(--success);
}

.kpi-card.risk .kpi-label i {
  background: var(--critical);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 10px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.panel-heading.compact {
  align-items: center;
}

.trend-panel,
.marketplace-panel,
.inventory-panel,
.reference-panel {
  grid-column: 1;
}

.action-rail {
  grid-column: 2;
  grid-row: 1 / span 3;
  display: grid;
  gap: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e7eef8;
  color: #234a80;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill.muted {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.pill.risk {
  background: #ffe4e6;
  color: var(--critical);
}

.bar-chart {
  height: 206px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 12px 14px 8px;
}

.bar-group {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 0;
}

.bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
  min-height: 0;
}

.bar {
  width: 18px;
  border-radius: 999px 999px 0 0;
}

.bar.revenue {
  background: linear-gradient(180deg, #3c86f6, #3267e3);
}

.bar.profit {
  background: linear-gradient(180deg, #ef5aa7, #f5b84b);
}

.bar-group small {
  text-align: center;
  color: var(--muted);
}

.legend {
  display: flex;
  gap: 10px;
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legend-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
}

.legend-dot.revenue {
  background: var(--primary);
}

.legend-dot.profit {
  background: var(--success);
}

.marketplace-list {
  display: grid;
}

.market-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(0, 2fr) auto;
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.market-row:last-child {
  border-bottom: 0;
}

.platform-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-chip > span {
  width: 9px;
  height: 30px;
  border-radius: 999px;
  background: var(--platform-color);
  box-shadow: 0 0 0 5px var(--platform-accent);
}

.platform-chip strong,
.platform-chip small {
  display: block;
}

.platform-chip small {
  color: var(--muted);
  font-size: 0.68rem;
}

dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 10px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
}

dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.sync {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: capitalize;
}

.sync.fresh,
.sync.success {
  background: #dcfce7;
  color: #166534;
}

.sync.watch,
.sync.warning {
  background: #fef3c7;
  color: #92400e;
}

.sync.stale {
  background: #fee2e2;
  color: #991b1b;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

td {
  font-size: 0.78rem;
}

td strong,
td span {
  display: block;
}

td span {
  color: var(--muted);
  margin-top: 2px;
}

.severity {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: capitalize;
}

.severity.critical {
  background: #ffe4e6;
  color: var(--critical);
}

.severity.high {
  background: #ffedd5;
  color: var(--risk);
}

.severity.medium {
  background: #fef3c7;
  color: var(--warning);
}

.severity.low {
  background: #e0f2fe;
  color: #075985;
}

.ghost-button,
.recommendation-card button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--primary);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 10px;
}

.stack-list,
.sync-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.alert-card,
.recommendation-card,
.sync-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface-soft);
}

.alert-card {
  border-left: 4px solid var(--warning);
}

.alert-card.critical {
  border-left-color: var(--critical);
}

.alert-card.high {
  border-left-color: var(--risk);
}

.alert-card strong,
.recommendation-card strong {
  display: block;
  margin-top: 6px;
  line-height: 1.35;
}

.alert-card p,
.recommendation-card p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.alert-card footer,
.recommendation-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.recommendation-card button {
  margin-top: 10px;
  width: 100%;
}

.sync-item {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sync-item strong,
.sync-item small {
  display: block;
}

.sync-item small {
  color: var(--muted);
  margin-top: 2px;
}

.mockup-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  padding: 10px;
}

.mockup-strip img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }

  .filters {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .action-rail,
  .trend-panel,
  .marketplace-panel,
  .inventory-panel,
  .reference-panel {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 840px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 14px;
    overflow: hidden;
  }

  .page-header {
    display: grid;
  }

  .header-actions {
    min-width: 0;
  }

  h1 {
    font-size: 1.55rem;
    overflow-wrap: anywhere;
  }

  .filters,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .header-center {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .market-row {
    grid-template-columns: 1fr;
  }

  dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bar-chart {
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .mockup-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--auth-mx, 50%) var(--auth-my, 45%), var(--auth-glow-a, rgba(56, 168, 255, 0.24)), transparent 30rem),
    radial-gradient(circle at calc(100% - var(--auth-mx, 50%)) 22%, var(--auth-glow-b, rgba(255, 152, 0, 0.16)), transparent 34rem),
    linear-gradient(135deg, #02040a 0%, var(--auth-bg, #050914) 48%, #0c1225 100%);
  color: #fff;
  position: relative;
}

#auth-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-center {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 28px;
  width: min(760px, 88vw);
  transform: translateY(-7.5vh);
}

.auth-logo {
  width: min(760px, 78vw);
  height: auto;
  filter:
    drop-shadow(0 0 18px rgba(255, 255, 255, 0.16))
    drop-shadow(0 0 46px rgba(85, 243, 255, 0.18));
  opacity: 0.98;
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(360px, 86vw);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.auth-card.warning {
  padding: 18px;
  border: 1px solid rgba(245, 184, 75, 0.28);
  border-radius: 18px;
  background: rgba(7, 17, 31, 0.5);
  backdrop-filter: blur(14px);
}

.auth-kicker,
.auth-card h2,
.auth-card p {
  display: none;
}

.auth-card.warning .auth-kicker,
.auth-card.warning h2,
.auth-card.warning p {
  display: block;
}

.auth-button {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(85, 243, 255, 0.92), rgba(56, 168, 255, 0.86));
  color: #03101e;
  cursor: pointer;
  font-weight: 900;
  padding: 12px 18px;
  box-shadow: 0 16px 44px rgba(56, 168, 255, 0.28), inset 0 1px 0 rgba(255,255,255,0.45);
}

.auth-button.google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.google-dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: #3267e3;
  font-weight: 900;
}

.auth-button.secondary {
  background: rgba(255,255,255,0.92);
  color: #03101e;
}

