:root {
  --pcdc-navy: #002b5c;
  --pcdc-navy-dark: #001e41;
  --pcdc-blue: #007bff;
  --pcdc-bg: #f4f6f9;
  --pcdc-border: #e4e8ef;
  --sidebar-width: 248px;
}

body {
  background: var(--pcdc-bg);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #182230;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #002b5c 0%, #001e41 100%);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 1.25rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #007bff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.sidebar .brand-title {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar .nav-link {
  color: #d6e4f5;
  border-radius: 0.5rem;
  padding: 0.62rem 0.8rem;
  margin: 0.08rem 0;
  font-size: 0.92rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1rem;
  font-size: 0.78rem;
  color: #9db6d4;
}

.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.metric-card,
.panel-card {
  border: 1px solid var(--pcdc-border);
  border-radius: 0.8rem;
  background: #fff;
}

.metric-card .metric {
  font-size: 1.7rem;
  font-weight: 700;
}

.table thead th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #687386;
  background: #f8fafc;
}

.product-thumb,
.media-thumb {
  width: 78px;
  height: 78px;
  border: 1px solid var(--pcdc-border);
  border-radius: 0.5rem;
  object-fit: contain;
  background: #fff;
}

.media-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.35rem;
  font-size: 0.68rem;
  color: #687386;
  background: #f8fafc;
}

.product-hero {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--pcdc-border);
  border-radius: 0.75rem;
}

.dropzone {
  border: 2px dashed #b7c4d6;
  border-radius: 0.9rem;
  background: #f8fbff;
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.stepper {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stepper .step {
  flex: 1;
  min-width: 120px;
  padding: 0.65rem 0.75rem;
  border-radius: 0.6rem;
  background: #eef2f7;
  color: #526072;
  font-size: 0.86rem;
}

.stepper .step.active {
  background: #002b5c;
  color: #fff;
}

.stepper .step.done {
  background: #d9efe4;
  color: #146c43;
}

.uom-box {
  border: 1px solid var(--pcdc-border);
  border-radius: 0.7rem;
  padding: 1rem 1.2rem;
  background: #f8fbff;
  min-width: 160px;
}

.login-page {
  background: var(--pcdc-bg);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-form-pane {
  width: 420px;
  max-width: 100%;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 2.5rem;
  border: 1px solid var(--pcdc-border);
  border-radius: 0.85rem;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
}

@media (max-width: 992px) {
  .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
  }

  .app-shell {
    display: block;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .sidebar nav {
    display: flex;
    flex-direction: row !important;
    overflow: auto;
    padding-bottom: 0.5rem;
  }

  .sidebar .nav-link {
    white-space: nowrap;
  }
}

.map-attr-panel {
  min-width: 240px;
}

.map-attr-combo {
  position: relative;
}

.map-attr-combo.is-enhanced [data-map-attr] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.map-attr-combo:not(.is-enhanced) [data-map-attr-search],
.map-attr-combo:not(.is-enhanced) [data-map-attr-menu] {
  display: none;
}

.map-attr-search {
  padding-right: 1.75rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m11.5 11.5-3-3m1-2.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.85rem;
}

.map-attr-menu {
  position: fixed;
  z-index: 1080;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

.map-attr-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: inherit;
}

.map-attr-option:hover,
.map-attr-option.is-active {
  background: #e7f1ff;
}

.map-attr-option.is-selected {
  font-weight: 600;
}

.map-attr-empty {
  padding: 0.5rem 0.65rem;
  font-size: 0.75rem;
  color: #6c757d;
}

.map-match-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.map-match-badge.match-exact {
  color: #0f5132;
  background: #d1e7dd;
}

.map-match-badge.match-partial {
  color: #9a3412;
  background: #ffedd5;
}

.map-match-badge.match-high {
  color: #0f5132;
  background: #c3e6cb;
}

.map-match-badge.match-mid {
  color: #084298;
  background: #cfe2ff;
}

.map-match-badge.match-low {
  color: #842029;
  background: #f8d7da;
}

.map-match-badge.match-custom {
  color: #3d0a91;
  background: #e2d9f3;
}

html.is-busy,
html.is-busy body {
  overflow: hidden;
}

html.is-busy .app-shell {
  pointer-events: none;
  user-select: none;
}

.app-busy-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(24, 34, 48, 0.55);
  align-items: center;
  justify-content: center;
  pointer-events: all;
  cursor: wait;
}

.app-busy-overlay.is-on,
.app-busy-overlay.is-on[hidden] {
  display: flex !important;
}

.app-busy-card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.75rem 2rem;
  min-width: 280px;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.pcd-dash {
  margin: -1.5rem;
  padding: 1.15rem 1.15rem 1.75rem;
  background: #f3f7fa;
  min-height: calc(100vh - 72px);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1f2937;
}

.pcd-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pcd-head h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #121826;
}

.pcd-head p {
  margin: 0.2rem 0 0;
  color: #8b93a7;
  font-size: 0.92rem;
}

.pcd-date {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #e7edf3;
  border-radius: 10px;
  padding: 0.48rem 0.85rem;
  color: #3d404f;
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.pcd-kpis,
.pcd-split {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pcd-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.pcd-section-title {
  margin: 0.15rem 0 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.pcd-kpi.tone-cyan { background: #e7f8f6; color: #1aa58f; }
.pcd-kpi.tone-sky { background: #e8f4ff; color: #3b82f6; }
.pcd-kpi.tone-amber { background: #fff4e8; color: #e08a2c; }
.pcd-kpi.tone-rose { background: #fdecee; color: #e25b6a; }

.pcd-card {
  background: #fff;
  border: 1px solid #e8eef3;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pcd-kpi {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 104px;
  padding: 1.05rem 1.2rem;
  border: none;
  border-radius: 16px;
  box-shadow: none;
}

.pcd-kpi.tone-blue { background: #e7f3fe; color: #4b93f8; }
.pcd-kpi.tone-green { background: #e7f8f2; color: #3cbe86; }
.pcd-kpi.tone-purple { background: #f1ecfc; color: #8f45f4; }
.pcd-kpi.tone-orange { background: #fef6e6; color: #f59a28; }

.pcd-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: inherit;
}

.pcd-kpi-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pcd-kpi-icon svg [fill="currentColor"] {
  fill: currentColor;
  stroke: none;
}

.pcd-kpi-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.pcd-kpi-label {
  color: #6d7585;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.2;
}

.pcd-kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1c2430;
  line-height: 1.1;
}

.pcd-card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.05rem 0.15rem;
}

.pcd-card-h h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
}

.pcd-filter { margin: 0; }
.pcd-filter select {
  border: 1px solid #e5e7eb;
  background-color: #fff;
  border-radius: 8px;
  padding: 0.28rem 1.7rem 0.28rem 0.65rem;
  font-size: 0.78rem;
  color: #4b5563;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 4.2 6 8l3.8-3.8' fill='none' stroke='%236b7280' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
}

.pcd-card-body { padding: 0.35rem 0.7rem 0.85rem; flex: 1; }
.pcd-card-body.is-top { padding: 0.7rem 1rem 1rem; }
.pcd-chart-svg { display: block; width: 100%; height: 268px; }
.pcd-chart-mfr { height: 360px; }

.pcd-key {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  color: #6b7280;
  font-size: 0.82rem;
  padding-bottom: 0.35rem;
}

.pcd-key span { display: inline-flex; align-items: center; gap: 0.4rem; }
.pcd-key i,
.pcd-qlegend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.pcd-quality {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.85rem 1rem;
}

.pcd-donut {
  position: relative;
  width: 158px;
  flex: 0 1 158px;
}

.pcd-donut-svg { display: block; width: 100%; height: auto; }

.pcd-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pcd-donut-label strong {
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: #121826;
  line-height: 1;
}

.pcd-donut-label span {
  margin-top: 0.15rem;
  color: #9aa3b2;
  font-size: 0.78rem;
}

.pcd-qlegend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
  min-width: 0;
}

.pcd-qlegend li {
  display: grid;
  grid-template-columns: 10px minmax(max-content, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.8rem;
}

.pcd-qname {
  color: #4b5563;
  white-space: nowrap;
}

.pcd-qnum {
  font-weight: 700;
  color: #1f2937;
  white-space: nowrap;
}

.pcd-qnum em {
  font-style: normal;
  font-weight: 500;
  color: #9aa3b2;
}

.pcd-cats {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.pcd-cats li {
  display: grid;
  grid-template-columns: 11.25rem minmax(0, 1fr) 4rem 2.5rem;
  gap: 0.55rem;
  align-items: center;
}

.pcd-cat-name {
  color: #4b5563;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcd-cat-track {
  height: 8px;
  background: #eef2f6;
  border-radius: 99px;
  overflow: hidden;
}

.pcd-cat-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #7c3aed 0%, #c4b5fd 100%);
}

.pcd-cat-num {
  text-align: right;
  font-weight: 700;
  font-size: 0.84rem;
  color: #1f2937;
}

.pcd-cat-pct {
  text-align: right;
  color: #9aa3b2;
  font-size: 0.82rem;
}

.pcd-empty {
  margin: 2rem 0;
  text-align: center;
  color: #9aa3b2;
}

@media (max-width: 1200px) {
  .pcd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pcd-split { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .pcd-dash { margin: -1rem; padding: 1rem; }
  .pcd-head { flex-direction: column; }
  .pcd-kpis { grid-template-columns: 1fr; }
  .pcd-quality { flex-direction: column; align-items: stretch; }
  .pcd-donut { width: 180px; flex-basis: auto; margin: 0 auto; }
  .pcd-cats li { grid-template-columns: 96px minmax(0, 1fr) 56px 36px; gap: 0.4rem; }
}

.category-typeahead { position: relative; }
.category-typeahead-menu {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
