:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f9fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e5e9f2;
  --line-strong: #d6dce8;
  --brand: #2f6fed;
  --brand-2: #174fb9;
  --good: #0f9f6e;
  --warn: #e09b21;
  --bad: #d64b4b;
  --shadow: 0 14px 38px rgba(16, 24, 40, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(47, 111, 237, 0.10), transparent 34rem),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 42%, #eef2f8 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

.card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--line);
  box-shadow: none;
}

.logoMark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: linear-gradient(165deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.sidebarTitle {
  margin: 14px 0 4px;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.sidebarSubtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.menuItem {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  color: #42526e;
  font-weight: 600;
}

.menuItem:hover {
  background: #f7f9ff;
  border-color: #dce5fa;
}

.menuItem.active {
  background: #eef4ff;
  border-color: #cadeff;
  color: var(--brand-2);
}

.sidebarBottom {
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: none;
}

.tinyTitle {
  font-size: 0.77rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #596780;
  font-weight: 700;
  margin-bottom: 6px;
}

.sidebarBottom p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px;
}

.topbar {
  padding: 10px 2px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.topbarTitle {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 3px;
}

.breadcrumbs {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.breadcrumbs a {
  color: var(--brand-2);
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.userPill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 8px;
  background: #fff;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #e9f0ff;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
}

.contentPanel {
  padding: 16px;
}

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

.panelHeader h3,
.catalogueHeader h3 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.gridStats {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  padding: 18px;
}

.stat .label {
  color: var(--muted);
  font-size: 13px;
}

.stat .value {
  font-size: 27px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.03em;
}

.stat .hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.search {
  position: relative;
  flex: 1;
  max-width: 560px;
}

.search input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 14px 12px 46px;
  background: #fff;
  outline: none;
  min-height: 44px;
}

.search input:focus {
  border-color: #9db9f7;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.10);
}

.search:before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
}

.ghostBtn,
.primaryBtn,
.dangerBtn,
.btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 12px;
  padding: 10px 13px;
  cursor: pointer;
  color: #26344d;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
}

.ghostBtn:hover,
.btn:hover {
  background: #f8fafc;
  text-decoration: none;
}

.primaryBtn,
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 111, 237, 0.22);
}

.primaryBtn:hover,
.btn-primary:hover {
  background: var(--brand-2);
  text-decoration: none;
}

.full {
  width: 100%;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #45556f;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}

.pill.blue {
  color: var(--brand-2);
  border-color: #bcd0ff;
  background: #f3f7ff;
}

.pill.good {
  color: var(--good);
  border-color: #b8e9d5;
  background: #f0fcf6;
}

.pill.warn {
  color: #9b6712;
  border-color: #f2d7a8;
  background: #fff8ea;
}

.brandList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding-top: 6px;
}

.alphaFilter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}

.alphaItem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #45556f;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.alphaItem:hover {
  text-decoration: none;
  background: #f8fafc;
}

.alphaItem.active {
  color: var(--brand-2);
  border-color: #bcd0ff;
  background: #f3f7ff;
}

.brandItem {
  display: block;
  color: inherit;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: 0.12s ease;
}

.brandItem:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
  border-color: #cbd7ef;
}

.brandName {
  font-weight: 800;
  font-size: 16px;
}

.brandMeta {
  margin-top: 7px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}

.catalogueHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

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

.tree {
  padding: 10px 2px 2px;
}

details.collection {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  margin: 10px 0;
  overflow: hidden;
}

details.collection[open] {
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
}

summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  background: linear-gradient(180deg, #fff, #fbfcff);
}

summary::-webkit-details-marker {
  display: none;
}

.collectionTitle {
  display: flex;
  gap: 9px;
  align-items: center;
  font-weight: 800;
}

.chev {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--brand);
  font-size: 12px;
}

details[open] .chev {
  transform: rotate(90deg);
}

.productList {
  border-top: 1px solid var(--line);
}

.product {
  display: grid;
  grid-template-columns: 56px 160px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 11px 15px;
  border-top: 1px solid #f0f2f7;
}

.previewBox {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, #f8fafc, #eef2f8);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.previewBoxLarge {
  width: 64px;
  height: 64px;
}

.productPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.previewPlaceholder::before {
  content: "C3D";
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  opacity: .55;
}

.previewMissing::before {
  content: "—";
  color: var(--muted);
}

.productHeader {
  display: flex;
  align-items: center;
  gap: 16px;
}

.productHeaderTitle {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.productHeaderMeta {
  margin: 6px 0 0;
}

.product:first-child {
  border-top: 0;
}

.product:hover {
  background: #fbfcff;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  color: #344054;
}

.pname {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sourcesBtn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
}

.sourcesBtn:hover {
  color: var(--brand-2);
  border-color: #abc4fa;
  text-decoration: none;
}

.tableWrap,
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.table th {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: #64748b;
}

.table tbody tr:hover {
  background: #f9fbff;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.status {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

.status-success,
.status.success {
  color: var(--good);
}

.status-failed,
.status.failed {
  color: var(--bad);
}

.status-running,
.status.running {
  color: var(--warn);
}

.status-skipped,
.status.skipped {
  color: #6b7280;
}

.status-no_changes,
.status.no_changes {
  color: #6b7280;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.emptyState {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  padding: 14px;
}

.details {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 14px;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
}

.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  background: #f1f6ff;
  border: 1px solid #cfe0ff;
  color: #244a8f;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

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

.authLayout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.authCard {
  width: min(460px, 100%);
  padding: 24px;
}

.authCard h1 {
  margin: 14px 0 6px;
  letter-spacing: -0.02em;
}

.form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: #344054;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="date"],
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

/* Keep search-field icon spacing after generic input rules. */
.search input[type="search"] {
  border-radius: 14px;
  min-height: 44px;
  padding-left: 46px;
}

input:focus {
  outline: none;
  border-color: #9db9f7;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.10);
}

.paginationBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.paginationInfo {
  color: var(--muted);
  font-size: 0.92rem;
}

.paginationControls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.formPanel {
  padding: 20px;
  max-width: 520px;
}

.formActions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.checkboxLabel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkboxLabel input[type="checkbox"] {
  width: auto;
}

.filterForm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
  align-items: end;
}

.actionsCell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inlineForm {
  display: inline;
  margin: 0;
}

.smallBtn {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.dangerBtn {
  color: var(--bad);
  border-color: #f3c7c7;
}

.dangerBtn:hover {
  background: #fef2f2;
}

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

.detailsCell {
  max-width: 280px;
}

.detailsJson {
  display: block;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #475467;
}

@media (max-width: 900px) {
  .app {
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: relative;
    width: auto;
    height: auto;
    margin-bottom: 12px;
  }

  .main {
    padding: 0;
  }

  .gridStats {
    grid-template-columns: repeat(2, 1fr);
  }

  .product {
    grid-template-columns: 48px 110px 1fr;
    gap: 8px;
  }

  .product .sourcesBtn {
    grid-column: 2 / -1;
    justify-self: start;
  }

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