:root {
  color-scheme: light;
  --page-bg: #6b87ec;
  --app-bg: #f4f1ea;
  --surface: #ffffff;
  --surface-alt: #faf8f3;
  --surface-soft: #f2efe9;
  --sidebar: #15192b;
  --sidebar-muted: #8f95ad;
  --text: #1d2233;
  --muted: #8a8f9d;
  --line: rgba(29, 34, 51, 0.08);
  --accent: #f35f86;
  --accent-strong: #ed4b77;
  --cyan-strong: #42bcc3;
  --ink: #1d2233;
  --shadow-lg: 0 36px 80px rgba(22, 27, 43, 0.2);
  --shadow-md: 0 16px 28px rgba(22, 27, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, var(--page-bg) 0 16%, transparent 16% 100%),
    linear-gradient(180deg, #f7f7fb 0%, #f4f1ea 100%);
}

body.modal-open {
  overflow: hidden;
}

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

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

input,
textarea,
button,
select {
  font: inherit;
}

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 34px 28px 60px;
}

.app-frame {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  overflow: hidden;
  padding: 22px;
  border-radius: 34px;
  background: var(--app-bg);
  box-shadow: var(--shadow-lg);
}

.panel,
.info-card,
.stat-card,
.detail-snapshot,
.metric,
.product-card,
.revision-card,
.empty-state,
.category-chip,
.topbar,
.filter-panel,
.setting-card,
.list-item {
  background: var(--surface);
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 28px 18px;
  color: white;
  background: var(--sidebar);
}

.sidebar-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.sidebar-brand strong {
  font-size: 1.1rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: linear-gradient(135deg, #ffb85c, #ff7c5e 42%, #b56df3 100%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.sidebar .muted {
  color: var(--sidebar-muted);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  color: #edf0ff;
  font-weight: 700;
  transition: background-color 140ms ease, color 140ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
}

.main-column {
  display: grid;
  gap: 18px;
  padding: 0;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: 28px;
  box-shadow: var(--shadow-md);
}

.topbar-copy {
  max-width: 54rem;
}

.eyebrow,
.section-kicker,
.stat-label,
.metric-label {
  margin-bottom: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.9rem, 3vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 0;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.lede,
.muted,
.meta-line,
.detail-subtitle {
  color: var(--muted);
}

.topbar-actions {
  position: relative;
  width: fit-content;
  align-self: flex-start;
}

.menu-toggle {
  display: none;
  width: 52px;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: white;
  font-size: 1.8rem;
  line-height: 1;
  background: var(--ink);
}

.mobile-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  display: grid;
  gap: 6px;
  min-width: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.mobile-menu[hidden] {
  display: none;
}

.mobile-menu a {
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 700;
}

.mobile-menu a:hover,
.mobile-menu a:focus-visible {
  background: var(--surface-soft);
}

.panel {
  padding: 22px;
  border-radius: 28px;
  box-shadow: var(--shadow-md);
}

.view-stack {
  display: none;
}

.view-stack.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 700;
}

.badge {
  color: white;
  background: var(--ink);
}

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

.stat-card {
  min-height: 172px;
  padding: 18px;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

.stat-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 2vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.stat-card p {
  margin-bottom: 0;
  line-height: 1.45;
}

.stat-card.coral {
  color: white;
  background: linear-gradient(135deg, #ff7b68, var(--accent));
}

.stat-card.aqua {
  color: white;
  background: linear-gradient(135deg, #6ad8de, var(--cyan-strong));
}

.stat-card.ink {
  color: white;
  background: linear-gradient(135deg, #2a3149, var(--ink));
}

.stat-card.pale {
  background: #fff4f6;
}

.dashboard-grid,
.list-columns,
.settings-grid {
  display: grid;
  gap: 16px;
}

.dashboard-grid {
  grid-template-columns: 1.2fr 0.9fr;
}

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

.info-card,
.filter-panel,
.setting-card {
  padding: 20px;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

.wide-card {
  grid-column: 1 / -1;
}

.product-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
}

.filter-panel {
  align-self: start;
}

.filter-heading {
  margin-top: 22px;
}

.list-stack,
.stack {
  display: grid;
  gap: 12px;
}

.list-row,
.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  text-align: left;
  background: var(--surface-alt);
}

.list-row:hover,
.list-row:focus-visible {
  border-color: rgba(99, 208, 213, 0.42);
}

.list-row strong,
.list-item strong {
  display: block;
  margin-bottom: 3px;
}

.mono,
pre {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.mono {
  font-size: 0.82rem;
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  background: var(--surface-alt);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(243, 95, 134, 0.4);
  box-shadow: 0 0 0 4px rgba(243, 95, 134, 0.12);
}

button {
  border: 0;
  color: white;
  cursor: pointer;
  border-radius: 18px;
  padding: 0 18px;
  min-height: 52px;
  font-weight: 700;
  background: var(--ink);
  transition: transform 140ms ease, opacity 140ms ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
}

.secondary-action {
  color: var(--ink);
  background: #eceaf0;
}

.ghost-action {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

#category-list {
  grid-auto-rows: min-content;
}

.category-path {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

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

.category-back {
  width: fit-content;
  min-height: 42px;
}

.filter-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.control-field {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.control-field span,
.form-grid label small,
.validation-list strong {
  font-size: 0.86rem;
}

.control-field span {
  font-weight: 700;
  color: var(--muted);
}

.category-chip,
.product-card,
.revision-card,
.empty-state,
.detail-snapshot,
.metric,
.list-item {
  border: 1px solid var(--line);
  border-radius: 18px;
}

.category-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  text-align: left;
  background: var(--surface-alt);
}

.category-chip.active {
  color: white;
  background: var(--ink);
}

.category-chip.all {
  background: #f1edf7;
}

.category-chip-arrow {
  font-size: 1rem;
  color: var(--muted);
}

.product-card,
.revision-card,
.empty-state {
  padding: 16px;
}

.product-card {
  display: grid;
  gap: 12px;
  background: var(--surface-alt);
}

.product-results {
  display: grid;
  gap: 16px;
}

.product-card-body,
.detail-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.product-card-copy,
.detail-hero-copy {
  min-width: 0;
}

.product-card.active {
  border-color: rgba(99, 208, 213, 0.6);
  box-shadow: 0 10px 22px rgba(99, 208, 213, 0.14);
}

.product-card-header,
.detail-header,
.row,
.actions,
.card-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.product-card-header,
.detail-header {
  align-items: start;
  justify-content: space-between;
}

.card-actions-row {
  justify-content: flex-start;
}

.product-thumb,
.detail-image {
  display: block;
  border: 1px solid var(--line);
  border-radius: 18px;
  object-fit: cover;
  background: var(--surface-soft);
}

.product-thumb {
  width: 96px;
  height: 96px;
}

.detail-image {
  width: 160px;
  height: 160px;
}

.product-thumb--placeholder,
.detail-image--placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  padding: 12px;
  background:
    linear-gradient(135deg, #f3efe7, #ebe6f3);
}

.card-actions-row .list-toggle,
.card-actions-row .card-action,
.modal-close {
  min-height: 44px;
}

.primary-line,
.detail-title {
  margin-bottom: 4px;
  font-size: 1.08rem;
  font-weight: 700;
}

.match-reason {
  margin-bottom: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.pill {
  min-height: 34px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 0.8rem;
}

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

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.editor-form {
  display: grid;
  gap: 18px;
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-alt);
}

.form-grid label,
.setting-card {
  display: grid;
  gap: 8px;
}

.form-grid label span {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.form-grid label small {
  color: var(--muted);
  line-height: 1.45;
}

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

.empty-state {
  border-style: dashed;
  background: var(--surface-alt);
}

.detail-panel {
  display: grid;
  gap: 14px;
}

.detail-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
}

.detail-snapshot {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.detail-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-alt);
}

.detail-list,
.revision-list,
.preview-stack,
.validation-list {
  display: grid;
  gap: 10px;
}

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

.detail-line {
  display: grid;
  gap: 4px;
}

.detail-line strong {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-line span {
  line-height: 1.45;
}

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

.data-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

.data-toggle summary {
  list-style: none;
}

.data-toggle summary::-webkit-details-marker {
  display: none;
}

.data-toggle + pre,
.data-toggle + .raw-panels {
  margin-top: 12px;
}

.raw-panels {
  display: grid;
  gap: 12px;
}

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

.metric {
  padding: 12px 14px;
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.revision-card {
  display: grid;
  gap: 10px;
}

.revision-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.revision-copy {
  line-height: 1.5;
}

.setting-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.setting-copy strong {
  display: block;
  margin-bottom: 4px;
}

pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: 18px;
  background: var(--ink);
  color: #f8f6f2;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.55;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 15, 24, 0.56);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow: auto;
  padding: 22px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.modal-close {
  color: var(--ink);
  background: #eceaf0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-alt);
}

.pagination-status {
  color: var(--muted);
  font-weight: 700;
}

.pagination-actions {
  display: flex;
  gap: 10px;
}

.pagination button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.preview-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-alt);
}

.preview-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.preview-copy {
  display: grid;
  gap: 4px;
}

.validation-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-alt);
}

.validation-item.warning {
  border-color: rgba(243, 95, 134, 0.28);
  background: #fff4f6;
}

.validation-item.ok {
  border-color: rgba(66, 188, 195, 0.32);
  background: #eefbfb;
}

@media (max-width: 1180px) {
  body {
    background: linear-gradient(180deg, #f7f7fb 0%, #f4f1ea 100%);
  }

  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .stats-grid,
  .dashboard-grid,
  .detail-content-grid,
  .detail-grid,
  .list-columns,
  .settings-grid,
  .product-layout,
  .editor-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-layout > :last-child {
    grid-column: 1 / -1;
  }

  .editor-layout > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 14px 14px 34px;
  }

  .topbar,
  .panel,
  .info-card,
  .filter-panel,
  .setting-card,
  .modal-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .stats-grid,
  .dashboard-grid,
  .detail-content-grid,
  .detail-grid,
  .form-grid,
  .toolbar,
  .list-columns,
  .settings-grid,
  .product-layout,
  .editor-layout,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .topbar,
  .product-card-body,
  .detail-hero,
  .product-card-header,
  .detail-header,
  .section-heading,
  .setting-card,
  .list-item {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: fit-content;
  }

  .filter-meta,
  .pagination,
  .pagination-actions,
  .revision-meta,
  .preview-header {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    position: sticky;
    bottom: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
  }

  .actions button,
  .toolbar button,
  .filter-meta button,
  .pagination button,
  .card-actions-row button,
  .modal-close {
    width: 100%;
  }

  .product-thumb,
  .detail-image {
    width: 100%;
    max-width: 180px;
    height: auto;
    aspect-ratio: 1;
  }

  .modal-panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    margin: 10px auto;
  }
}
