:root {
  color-scheme: light;
  --Background: #ffffff;
  --Panel: #ffffff;
  --Text: #000000;
  --Muted: #5a5a5a;
  --Border: #000000;
  --SoftBorder: #d8d8d8;
  --Pressed: #efefef;
  --Warning: #8a5a00;
  --WarningBackground: #fff7df;
  --Error: #b00020;
  --ErrorBackground: #fff1f3;
  --Success: #126b32;
  --SuccessBackground: #edfff3;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --Background: #000000;
  --Panel: #000000;
  --Text: #ffffff;
  --Muted: #b7b7b7;
  --Border: #ffffff;
  --SoftBorder: #3c3c3c;
  --Pressed: #171717;
  --Warning: #ffd36b;
  --WarningBackground: #211900;
  --Error: #ff8a9b;
  --ErrorBackground: #260006;
  --Success: #7dffa6;
  --SuccessBackground: #001f0a;
}

* {
  box-sizing: border-box;
}

html,
body,
#App {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--Background);
  color: var(--Text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.AppShell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--Background);
}

.Sidebar {
  min-height: 100vh;
  border-right: 1px solid var(--Border);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

.BrandBlock {
  display: flex;
  align-items: center;
  gap: 12px;
}

.BrandBlock strong,
.BrandBlock span {
  display: block;
}

.BrandBlock span,
.SidebarFooter span,
.MutedText,
.MetricCard small,
.NotificationCard span,
.ResolvedRow small {
  color: var(--Muted);
}

.BrandMark {
  width: 42px;
  height: 42px;
  border: 2px solid var(--Border);
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 800;
}

.NavList {
  display: grid;
  gap: 8px;
}

.NavButton,
.IconTextButton,
.SecondaryButton,
.PrimaryButton,
.TextButton,
.IconButton {
  border-radius: 6px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.NavButton:active,
.IconTextButton:active,
.SecondaryButton:active,
.PrimaryButton:active,
.TextButton:active,
.IconButton:active {
  transform: translateY(1px);
}

.NavButton {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--Text);
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.NavButton.Active,
.NavButton:hover {
  border-color: var(--Border);
  background: var(--Pressed);
}

.SidebarFooter {
  margin-top: auto;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.SidebarFooter span {
  overflow-wrap: anywhere;
}

.MainSurface {
  min-width: 0;
}

.Page {
  width: min(1180px, calc(100vw - 320px));
  margin: 0 auto;
  padding: 36px 28px 64px;
}

.ScrollPage {
  min-height: 100vh;
}

.PageHeader,
.SectionHeader,
.BadListingTopline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.PageHeader {
  margin-bottom: 28px;
}

.Eyebrow {
  margin: 0 0 6px;
  color: var(--Muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
}

.MetricGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.MetricCard,
.SectionBlock,
.NotificationCard,
.BadListingCard,
.AuthPanel,
.ModalPanel,
.EmptyState {
  border: 1px solid var(--Border);
  border-radius: 8px;
  background: var(--Panel);
}

.MetricCard {
  min-height: 142px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

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

.MetricCard span,
.MetricCard p {
  color: var(--Muted);
}

.MetricCard strong {
  font-size: 1.8rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.SectionBlock {
  padding: 20px;
}

.NotificationList,
.BadListingList,
.Stack,
.ResolvedList {
  display: grid;
  gap: 12px;
}

.NotificationList {
  margin-top: 16px;
}

.ProgressBlock {
  margin-bottom: 18px;
}

.ProgressBar {
  width: 100%;
  height: 12px;
  border: 1px solid var(--Border);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0 10px;
}

.ProgressFill {
  height: 100%;
  background: var(--Text);
  transition: width 180ms ease;
}

.NotificationCard {
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.NotificationCard.Unread {
  box-shadow: inset 4px 0 0 var(--Border);
}

.NotificationCard p,
.AmazonTitle,
.MetricCard p {
  margin-bottom: 0;
}

.SettingsGrid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
}

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

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--Border);
  background: var(--Background);
  color: var(--Text);
  border-radius: 6px;
  min-height: 42px;
  padding: 9px 10px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--Text);
  outline-offset: 2px;
}

.CheckLine {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.CheckLine input,
.ResolveCell input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--Text);
}

.InlineActions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.PrimaryButton,
.SecondaryButton,
.IconTextButton,
.LinkButton {
  min-height: 40px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.PrimaryButton {
  border: 1px solid var(--Border);
  background: var(--Text);
  color: var(--Background);
  font-weight: 800;
}

.SecondaryButton,
.IconTextButton {
  border: 1px solid var(--Border);
  background: var(--Background);
  color: var(--Text);
  font-weight: 700;
}

.IconButton {
  width: 38px;
  height: 38px;
  border: 1px solid var(--Border);
  background: var(--Background);
  color: var(--Text);
  display: grid;
  place-items: center;
}

.TextButton {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--Text);
  font-weight: 800;
  text-decoration: underline;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.StatusPill {
  width: max-content;
  border: 1px solid var(--Border);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 800;
}

.StatusPill.ok {
  color: var(--Success);
  background: var(--SuccessBackground);
}

.StatusPill.warn {
  color: var(--Warning);
  background: var(--WarningBackground);
}

.StatusPill.bad {
  color: var(--Error);
  background: var(--ErrorBackground);
}

.StatusPill.neutral {
  color: var(--Text);
  background: var(--Background);
}

.ErrorText {
  color: var(--Error);
  font-weight: 700;
}

.SuccessText {
  color: var(--Success);
  font-weight: 700;
}

.CenteredPanel,
.AuthShell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.AuthPanel {
  width: min(420px, 100%);
  padding: 26px;
  display: grid;
  gap: 22px;
}

.EmptyState {
  padding: 26px;
  display: grid;
  justify-items: start;
  gap: 8px;
}

.Spin {
  animation: Spin 900ms linear infinite;
}

@keyframes Spin {
  to {
    transform: rotate(360deg);
  }
}

.BadListingList {
  margin-bottom: 16px;
}

.BadListingCard {
  padding: 16px;
  display: grid;
  grid-template-columns: auto 92px 1fr;
  gap: 16px;
  align-items: start;
}

.ResolveCell {
  padding-top: 4px;
}

.ProductImage,
.ImageFallback {
  width: 92px;
  aspect-ratio: 1;
  border: 1px solid var(--SoftBorder);
  border-radius: 6px;
  object-fit: contain;
  background: var(--Background);
}

.ImageFallback {
  display: block;
}

.BadListingBody {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.BadListingTopline h2 {
  overflow-wrap: anywhere;
}

.ListingFacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ListingFacts span {
  border: 1px solid var(--SoftBorder);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--Muted);
}

.IssueList {
  margin: 0;
  padding-left: 20px;
  color: var(--Error);
  font-weight: 700;
}

.HistoryBlock {
  margin-top: 18px;
}

.ResolvedRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--SoftBorder);
  padding-top: 10px;
}

.ResolvedRow span {
  overflow-wrap: anywhere;
}

.ModalBackdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--Background) 72%, transparent);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.ModalPanel {
  width: min(440px, 100%);
  padding: 24px;
  display: grid;
  gap: 16px;
  position: relative;
}

.ModalClose {
  position: absolute;
  top: 14px;
  right: 14px;
}

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

  .Sidebar {
    min-height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--Border);
  }

  .NavList {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .NavButton {
    justify-content: center;
  }

  .SidebarFooter {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .Page {
    width: 100%;
  }

  .MetricGrid,
  .SettingsGrid {
    grid-template-columns: 1fr;
  }

  .MetricCard.Wide {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .Page {
    padding: 24px 16px 48px;
  }

  .PageHeader,
  .SectionHeader,
  .BadListingTopline,
  .NotificationCard {
    display: grid;
  }

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

  .BadListingCard {
    grid-template-columns: auto 1fr;
  }

  .ProductImage,
  .ImageFallback {
    grid-column: 2;
    width: 78px;
  }

  .BadListingBody {
    grid-column: 1 / -1;
  }

  .NavButton {
    padding: 9px 8px;
    font-size: 0.86rem;
  }

  .PrimaryButton,
  .SecondaryButton,
  .IconTextButton,
  .LinkButton {
    width: 100%;
    white-space: normal;
  }
}
