:root {
  --bg: #f3f3f3;
  --bg-warm: #ede9e4;
  --bg-accent: #e8e4de;
  --surface: #ffffff;
  --ink: #0e0e0e;
  --ink-soft: #798897;
  --line: #e4e7ea;
  --line-strong: #d0d5db;
  --control-bg: #efeeec;
  --control-btn-bg: #e4e2df;
  --accent: #0e0e0e;
  --accent-soft: #f0eeeb;
  --warn: #9a6700;
  --warn-soft: #f5e8c7;
  --danger: #b42318;
  --danger-soft: #fce8e6;
  --ok: #1f7a4d;
  --ok-soft: #e6f4ec;
  --radius: 0;
  --shadow: none;
  --font: "DM Sans", "Helvetica Neue", Helvetica, sans-serif;
  --sidebar-w: 248px;
  --sidebar-collapsed-w: 72px;
  --feed-w: 320px;
  --sidebar-bg: #0e0e0e;
  --sidebar-ink: #ffffff;
  --sidebar-muted: #9ea3af;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(237, 233, 228, 0.95), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(243, 243, 243, 0.95), transparent 50%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select,
textarea {
  border: none;
  border-radius: 0;
  background: var(--control-bg);
  color: var(--ink);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(14, 14, 14, 0.12);
  outline-offset: 0;
}

code {
  font-size: 0.85em;
  background: #f3f3f3;
  padding: 0.1em 0.35em;
  border-radius: 0;
}

/* ── App shell ── */
.app-body {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-content {
  display: flex;
  flex: 1;
  min-height: 0;
}

.app-content.has-feed .page {
  flex: 1;
  min-width: 0;
}

.page {
  flex: 1;
  padding: 1.35rem 1.5rem 1.5rem;
  max-width: 100%;
  overflow-x: hidden;
}

/* ── Sidebar (AM.PM dark) ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  border-right: none;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  transition: width 0.2s ease;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0.9rem 0.95rem;
  border-bottom: none;
  gap: 0.35rem;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 108px;
  height: auto;
  max-width: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  overflow: hidden;
  padding-left: 0.05rem;
}

.brand-text strong {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
}

.brand-text small {
  color: var(--sidebar-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.sidebar-toggle {
  border: none;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--sidebar-muted);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.55rem;
}

.nav-group { margin-bottom: 1rem; }

.nav-group-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  font-weight: 600;
  padding: 0 0.55rem 0.4rem;
}

.nav-item,
.nav-parent {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #c5cad1;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-parent:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.is-active,
.nav-sub-item.is-active {
  background: #fff;
  color: #0e0e0e;
  font-weight: 600;
}

.nav-icon {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-chevron {
  margin-left: auto;
  font-size: 0.7rem;
  transition: transform 0.15s;
}

.nav-parent.is-open .nav-chevron { transform: rotate(180deg); }

.nav-sub {
  padding-left: 0.5rem;
  margin-top: 0.15rem;
}

.nav-sub.is-collapsed { display: none; }

.nav-sub-item {
  display: block;
  padding: 0.4rem 0.65rem 0.4rem 2.1rem;
  border-radius: 0;
  font-size: 0.85rem;
  color: #9ea3af;
}

.nav-sub-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-stub { opacity: 0.45; cursor: not-allowed; }
.nav-item.nav-inactive {
  opacity: 0.42;
}
.nav-item.nav-inactive:hover {
  opacity: 0.7;
}
.nav-item.nav-inactive.is-active {
  opacity: 0.85;
}

.sidebar-foot {
  border-top: none;
  padding: 0.65rem 0.55rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.65rem 0.5rem;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: #fff;
  color: #0e0e0e;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.user-name { font-size: 0.85rem; color: var(--sidebar-muted); }

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

/* Collapsed sidebar */
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-group-label,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-chevron,
.sidebar-collapsed .nav-sub,
.sidebar-collapsed .user-name,
.sidebar-collapsed .sidebar-logout .nav-label { display: none; }
.sidebar-collapsed .brand-logo {
  width: 36px;
  height: 28px;
  object-fit: cover;
  object-position: left center;
}
.sidebar-collapsed .brand { align-items: center; }
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar-collapsed .nav-item,
.sidebar-collapsed .nav-parent { justify-content: center; padding: 0.55rem; }
.sidebar-collapsed .sidebar-user { justify-content: center; }

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  padding: 1rem 1.5rem 1.25rem;
  border-top: none;
  background: rgba(255, 255, 255, 0.55);
}

.site-footer.is-compact {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  border-top: none;
  text-align: center;
  padding: 1rem;
}

.site-footer-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.site-footer.is-compact .site-footer-inner { justify-content: center; }

.site-footer-brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-transform: uppercase;
  font-size: 0.72rem;
}

.site-footer-copy { color: var(--ink-soft); }

/* ── Page head & KPI ── */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0 0 0.2rem;
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

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

.period-form {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.period-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.period-form input[type="date"] {
  border: none;
  background: var(--control-bg);
  border-radius: 0;
  height: 2.35rem;
  padding: 0 0.65rem;
  min-width: 140px;
  box-sizing: border-box;
  line-height: 1;
}

.period-form .btn {
  height: 2.35rem;
  padding: 0 0.85rem;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn {
  border: none;
  border-radius: 0;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font-weight: 550;
  background: var(--control-btn-bg);
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #101010; color: #fff; }
.btn-ghost { border: none; background: var(--control-btn-bg); color: var(--ink); }
.btn-ghost:hover { background: #101010; color: #fff; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; margin-top: 0.6rem; width: fit-content; }
.btn-block { width: 100%; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kpi {
  background: var(--surface);
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0.9rem 1rem;
}

.kpi header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
}
.kpi-date { font-size: 0.75rem; color: var(--ink-soft); }
.kpi-value { font-size: 1.55rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-meta { margin-top: 0.15rem; color: var(--ink-soft); font-size: 0.82rem; }
.kpi-today { border-color: transparent; }

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

.kpi-value-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.kpi-meta a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.kpi-integrations .kpi-value {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.dash-health-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #1f7a4d;
  flex-shrink: 0;
}

.kpi-integrations-green .dash-health-dot { background: #1f7a4d; }
.kpi-integrations-yellow .dash-health-dot { background: #b78105; }
.kpi-integrations-red .dash-health-dot { background: #b42318; }
.kpi-integrations-yellow .kpi-value { color: #8a6200; }
.kpi-integrations-red .kpi-value { color: #b42318; }

.dash-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dash-insights-grid > .panel { margin-bottom: 0; }

.dash-sku-table .col-thumb { width: 44px; }
.dash-sku-table .col-product {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-sku-table .product-title-link {
  color: inherit;
  text-decoration: none;
}
.dash-sku-table .product-title-link:hover { text-decoration: underline; }
.dash-sku-table .is-pos { color: #1f7a4d; }
.dash-sku-table .is-neg { color: #b42318; }
.dash-sku-table .is-warn { color: #b78105; }
.dash-delta-pct {
  display: block;
  font-size: 0.72rem;
  color: inherit;
  opacity: 0.85;
}

@keyframes todayFlash {
  0% { box-shadow: none; background: #f3faf7; }
  100% { box-shadow: none; background: var(--surface); }
}
.today-updated { animation: todayFlash 1.2s ease-out 0s 2; }

/* ── Panels & tables ── */
.panel {
  background: var(--surface);
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1rem;
}

.panel-muted { background: #f7f5f2; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.panel-head h2 { margin: 0; font-size: 1rem; font-weight: 600; }

.panel-head-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel-head-meta .btn-sm {
  margin-top: 0;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
  color: #fff;
  font-weight: 700;
  padding: 0.7rem 0.65rem;
  border: none;
  background: #2f6db5;
  white-space: nowrap;
}

.data-table th.num {
  text-align: center;
}

.data-table td {
  padding: 0.55rem 0.65rem;
  border: none;
  vertical-align: middle;
  background: #fff;
}

.data-table .num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.online-fact-table .num {
  text-align: right;
}

.online-fact-table .is-pos,
.analytics-sku-table .is-pos,
.analytics-country-table .is-pos,
.analytics-trends-table .is-pos { color: #1f7a4d; }
.online-fact-table .is-neg,
.analytics-sku-table .is-neg,
.analytics-country-table .is-neg,
.analytics-trends-table .is-neg { color: #b42318; }
.analytics-sku-table .col-thumb { width: 56px; }
.analytics-sku-table .col-product {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analytics-sku-table .col-product .product-title-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analytics-sku-table .th-sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.analytics-sku-table .th-sort-link:hover {
  text-decoration: underline;
}
.analytics-sku-table th.th-sort.is-sorted .th-sort-link {
  text-decoration: underline;
}
.analytics-country-table .th-sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.analytics-country-table .th-sort-link:hover,
.analytics-country-table th.th-sort.is-sorted .th-sort-link {
  text-decoration: underline;
}
.analytics-trends-table .th-sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.analytics-trends-table .th-sort-link:hover,
.analytics-trends-table th.th-sort.is-sorted .th-sort-link {
  text-decoration: underline;
}
.analytics-trends-table .col-trend-bar {
  min-width: 120px;
  width: 160px;
}
.analytics-trends-table .trend-bar {
  height: 10px;
  background: #e8eef5;
  border-radius: 4px;
  overflow: hidden;
}
.analytics-trends-table .trend-bar > span {
  display: block;
  height: 100%;
  background: #2f6db5;
  border-radius: 4px;
  min-width: 0;
}
.analytics-categories-table .is-pos { color: #1f7a4d; }
.analytics-categories-table .is-neg { color: #b42318; }
.analytics-marketplace-table .is-pos { color: #1f7a4d; }
.analytics-marketplace-table .is-neg { color: #b42318; }
.analytics-marketplace-table .th-sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.analytics-marketplace-table .th-sort-link:hover,
.analytics-marketplace-table th.th-sort.is-sorted .th-sort-link {
  text-decoration: underline;
}
.analytics-categories-table .cat-name-cell {
  white-space: nowrap;
}
.analytics-categories-table .cat-level-2 td {
  background: #fafafa;
  color: var(--ink-soft);
  font-size: 0.86rem;
}
.analytics-categories-table .cat-level-3 td {
  background: #f5f7fa;
  color: var(--ink-soft);
  font-size: 0.84rem;
}
.analytics-categories-table .cat-level-2 .cat-name-cell {
  padding-left: 1.4rem;
}
.analytics-categories-table .cat-level-3 .cat-name-cell {
  padding-left: 2.6rem;
}
.analytics-categories-table .toggle-spacer {
  display: inline-block;
  width: 1rem;
}
.online-fact-table .total-row .is-pos,
.online-fact-table .total-row .is-neg { color: #fff; }

.cell-strong { font-weight: 550; }

/* Marketplace icons */
.mp-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 0;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 0.45rem;
}

.mp-icon-sm {
  width: 24px;
  height: 24px;
  font-size: 0.65rem;
  border-radius: 0;
}
.mp-icon-sm:not([style*="background"]) {
  background: var(--ink);
}

/* Daily table sticky cols */
.mp-daily-table .col-mp {
  min-width: 180px;
  max-width: 220px;
}

.mp-daily-table .col-total {
  min-width: 72px;
  font-weight: 600;
}

.mp-daily-table .col-day {
  min-width: 52px;
  font-size: 0.82rem;
}

.mp-daily-table .col-sticky {
  position: sticky;
  background: var(--surface);
  z-index: 2;
}

.mp-daily-table .col-mp { left: 0; }
.mp-daily-table .col-total { left: 180px; box-shadow: none; }

.mp-daily-table thead .col-sticky {
  background: #2f6db5;
  color: #fff;
  z-index: 3;
}

.mp-daily-table .is-zero { color: #c5ced6; }
.mp-daily-table .has-value { color: var(--ink); }

.toggle-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 0.25rem 0 0;
  font-size: 0.75rem;
  vertical-align: middle;
}

.country-row td { color: var(--ink-soft); font-size: 0.82rem; background: #fafafa; }
.country-row .col-sticky { background: #fafafa; }
.country-cell { padding-left: 1.6rem !important; }
.country-flag {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Intermediate group totals (e.g. Total MP) */
.subtotal-row td {
  font-weight: 700;
  color: var(--ink);
  background: #f0f0f0;
  border: none;
}

.subtotal-row .col-sticky { background: #f0f0f0; }

/* Grand total row */
.total-row td {
  font-weight: 700;
  color: #fff;
  background: #9a9a9a;
  border: none;
}

.total-row .col-sticky { background: #9a9a9a; color: #fff; }
.total-row .is-zero { color: rgba(255, 255, 255, 0.55); }
.total-row .has-value { color: #fff; }

/* ── Integrations (Settings) ── */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.integration-card {
  border: none;
  border-radius: 0;
  padding: 0.85rem;
  background: #fbfbfb;
}

.integration-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.badge {
  font-size: 0.65rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.4rem;
  border-radius: 0;
  background: #eef2f5;
  color: var(--ink-soft);
}

.status-ok .badge { background: var(--accent-soft); color: var(--ok); }
.status-broken .badge { background: var(--danger-soft); color: var(--danger); }
.status-stale .badge { background: var(--warn-soft); color: var(--warn); }

.sync-matrix-table {
  min-width: 860px;
}
.sync-matrix-table .col-sticky {
  min-width: 140px;
}
.sync-mp-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  white-space: nowrap;
}
.sync-matrix-table .col-sync-method {
  text-align: center;
  min-width: 88px;
}
.sync-cell {
  text-align: center;
  vertical-align: middle;
  padding: 0.55rem 0.4rem;
}
.sync-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  background: #eef2f5;
  color: var(--ink-soft);
}
.sync-cell .sync-pill,
.sync-matrix-legend .sync-pill {
  margin-right: 0.15rem;
}
.sync-cell.status-ok .sync-pill,
.sync-matrix-legend .sync-pill.status-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.sync-cell.status-stale .sync-pill,
.sync-matrix-legend .sync-pill.status-stale {
  background: var(--warn-soft);
  color: var(--warn);
}
.sync-cell.status-error .sync-pill,
.sync-matrix-legend .sync-pill.status-error {
  background: var(--danger-soft);
  color: var(--danger);
}
.sync-cell.status-skipped .sync-pill {
  background: #eef2f5;
  color: var(--ink-soft);
}
.sync-cell.status-never .sync-pill,
.sync-matrix-legend .sync-pill.status-never {
  background: #f0f0f0;
  color: #9aa3ad;
}
.sync-cell.status-dev .sync-pill,
.sync-matrix-legend .sync-pill.status-dev {
  background: #ececec;
  color: #6b7280;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.62rem;
}
.sync-cell.status-dev .sync-age { display: none; }
.sync-age {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.sync-error-msg {
  display: block;
  margin-top: 0.25rem;
  max-width: 14rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--danger);
  word-break: break-word;
  white-space: normal;
  text-align: center;
}
.sync-matrix-legend {
  margin: 0.85rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  font-size: 0.8rem;
}

.integration-script { font-size: 0.75rem; margin-bottom: 0.25rem; }
.integration-meta { font-size: 0.8rem; color: var(--ink-soft); }
.integration-note { margin-top: 0.3rem; font-size: 0.76rem; color: #7a8792; }
.integration-note.is-error { color: var(--danger); font-weight: 600; }

/* ── Right orders feed ── */
.orders-feed {
  width: var(--feed-w);
  flex-shrink: 0;
  background: var(--surface);
  border-left: none;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.2s ease, margin 0.2s ease;
}

.orders-feed.is-collapsed {
  width: 44px;
  overflow: hidden;
}

.orders-feed.is-collapsed .orders-feed-head h2,
.orders-feed.is-collapsed .orders-feed-meta,
.orders-feed.is-collapsed .orders-feed-body { display: none; }

.orders-feed-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 0.85rem 0.75rem;
  border-bottom: none;
  background: #f7f5f2;
}

.orders-feed-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.orders-feed-meta {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 0;
  background: var(--ok);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.feed-collapse-btn {
  border: none;
  background: var(--surface);
  border-radius: 0;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.orders-feed.is-collapsed .feed-collapse-btn { transform: rotate(180deg); }

.kpi-feed.is-collapsed .kpi-feed-body,
.kpi-feed.is-collapsed .orders-feed-meta { display: none; }

.kpi-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.kpi-feed-card {
  display: block;
  background: #f7f5f2;
  padding: 0.65rem 0.7rem 0.7rem;
  text-decoration: none;
  color: inherit;
  border-left: 2px solid transparent;
}
a.kpi-feed-card:hover {
  background: #f0eeeb;
}
.kpi-feed-card.is-active {
  border-left-color: #2f6db5;
  background: #eef4fb;
}
.kpi-feed-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.kpi-feed-top .mp-icon {
  width: 20px;
  height: 20px;
  font-size: 0.55rem;
  flex-shrink: 0;
}
.kpi-feed-name {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-feed-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.kpi-feed-value.is-high { color: #168a45; }
.kpi-feed-value.is-mid { color: #b45309; }
.kpi-feed-value.is-low { color: #b42318; }
.kpi-feed-bar {
  height: 3px;
  background: #e4e2df;
  margin: 0.4rem 0 0.35rem;
  overflow: hidden;
}
.kpi-feed-bar > span {
  display: block;
  height: 100%;
  background: #2f6db5;
}
.kpi-feed-meta {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.kpi-feed-detail {
  float: right;
  color: var(--ink-soft);
}
a.kpi-feed-card:hover .kpi-feed-detail {
  color: var(--accent);
}

.empty-state {
  padding: 2rem 1.25rem;
  text-align: center;
}
.empty-state h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.mp-mapping-toolbar {
  margin-bottom: 1rem;
}
.mp-mapping-toolbar-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.mp-mapping-toolbar-main h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.mp-mapping-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.mp-mapping-hint {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
}
.mp-mapping-table .mp-mapping-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.mp-mapping-picker {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: min(100%, 420px);
  flex: 1;
}
.mp-cat-filter {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ddd;
  font: inherit;
  font-size: 0.82rem;
}
.mp-cat-select {
  width: 100%;
  max-width: 100%;
  font: inherit;
  font-size: 0.82rem;
}
.mp-tab-placeholder .empty-state {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.kpi-feed-avg {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.kpi-feed-avg.is-below { color: #b42318; }
.kpi-feed-avg.is-above { color: #168a45; }
.kpi-feed-avg.is-flat { color: var(--ink-soft); }

.orders-feed-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
}

.feed-empty {
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem 0.5rem;
}

.feed-list { display: flex; flex-direction: column; gap: 0.55rem; }

.feed-card {
  border: none;
  border-radius: 0;
  padding: 0.65rem 0.7rem;
  background: #fbfbfb;
  animation: feedIn 0.35s ease;
  display: block;
  color: inherit;
  text-decoration: none;
}
a.feed-card:hover {
  background: #f3f3f3;
}

@keyframes feedIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-pulse { animation: feedPulse 0.8s ease; }

@keyframes feedPulse {
  0% { box-shadow: none; }
  100% { box-shadow: none; }
}

.feed-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.feed-card-head {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.feed-card-head strong {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-card-head span { font-size: 0.72rem; color: var(--ink-soft); flex-shrink: 0; }

.feed-card-mp {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
}

.feed-card-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.feed-card-item img,
.feed-item-ph {
  width: 36px;
  height: 36px;
  border-radius: 0;
  object-fit: contain;
  background: #fff;
  border: none;
  flex-shrink: 0;
}

.feed-item-title {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-item-meta { font-size: 0.7rem; color: var(--ink-soft); margin-top: 0.1rem; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 32, 40, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.modal-overlay[hidden] { display: none; }

.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: none;
  background: #f7f5f2;
}

.modal-head h3 { margin: 0; font-size: 0.92rem; font-weight: 600; }

.modal-close {
  border: 0;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}

.modal-body { padding: 0.4rem 0.75rem 1rem; max-height: 60vh; overflow: auto; }

/* Auth moved above */

/* Responsive */
@media (max-width: 1100px) {
  .orders-feed { width: 280px; }
  .mp-daily-table .col-total { left: 160px; }
  .mp-daily-table .col-mp { min-width: 160px; }
}

@media (max-width: 900px) {
  .app-content.has-feed { flex-direction: column; }
  .orders-feed {
    width: 100%;
    height: auto;
    max-height: 360px;
    position: relative;
    border-left: 0;
    border-top: none;
  }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-grid-pulse { grid-template-columns: 1fr; }
  .dash-insights-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .sidebar { position: fixed; transform: translateX(-100%); }
  .sidebar-collapsed .sidebar { transform: translateX(0); width: var(--sidebar-collapsed-w); }
  .page { padding: 1rem; }
}


.kpi-today { border-color: transparent; }

@keyframes todayFlash {
  0% { box-shadow: none; background: #f7f5f2; }
  100% { box-shadow: none; background: var(--surface); }
}
.today-updated { animation: todayFlash 1.2s ease-out 0s 2; }

.status-ok .badge { background: var(--ok-soft); color: var(--ok); }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1.5rem 4rem;
  background-color: #1a1a1a;
  background-image:
    linear-gradient(180deg, rgba(12, 12, 12, 0.45) 0%, rgba(12, 12, 12, 0.28) 100%),
    var(--auth-bg-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.auth-body .site-footer.is-compact {
  color: rgba(255, 255, 255, 0.72);
}
.auth-body .site-footer.is-compact .site-footer-brand,
.auth-body .site-footer.is-compact .site-footer-copy {
  color: rgba(255, 255, 255, 0.78);
}

.auth-shell { width: min(420px, 100%); }

.auth-panel {
  background: rgba(255, 255, 255, 0.96);
  border: none;
  border-radius: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  padding: 1.6rem 1.5rem 1.5rem;
  backdrop-filter: blur(6px);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}

.auth-logo {
  display: block;
  width: 132px;
  height: auto;
}

.auth-brand strong { display: block; font-size: 1.05rem; letter-spacing: -0.01em; }
.auth-brand p { margin: 0.15rem 0 0; color: var(--ink-soft); font-size: 0.88rem; }

.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.auth-form input {
  border: none;
  border-radius: 0;
  padding: 0.65rem 0.75rem;
  background: var(--control-bg);
}

.auth-form input:focus {
  outline: 2px solid rgba(14, 14, 14, 0.12);
  border-color: transparent;
}

.flash {
  padding: 0.65rem 0.8rem;
  border-radius: 0;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-ok { background: var(--ok-soft); color: var(--ok); }

.sidebar-user-link {
  text-decoration: none;
  color: inherit;
}
.sidebar-user-link:hover .user-name {
  text-decoration: underline;
}

.profile-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.profile-summary {
  text-align: center;
  padding: 1.25rem 1rem;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.75rem;
  display: grid;
  place-items: center;
  background: #2f6db5;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
}
.profile-summary-name {
  font-weight: 650;
  font-size: 1.05rem;
}
.profile-summary-meta {
  margin-top: 0.15rem;
  font-size: 0.82rem;
}
.profile-facts {
  margin: 1.1rem 0 0;
  text-align: left;
  display: grid;
  gap: 0.65rem;
}
.profile-facts div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
}
.profile-facts dt {
  color: var(--ink-soft);
  margin: 0;
}
.profile-facts dd {
  margin: 0;
  font-weight: 550;
}
.profile-main {
  display: grid;
  gap: 1rem;
}
.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.profile-form input,
.profile-form select {
  height: 2.35rem;
  padding: 0 0.65rem;
  border: none;
  background: var(--control-bg);
  color: var(--ink);
  font-size: 0.9rem;
}
.profile-form input:focus,
.profile-form select:focus {
  outline: 2px solid rgba(47, 109, 181, 0.25);
}
.profile-span-2 { grid-column: 1 / -1; }
.profile-form-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  align-items: center;
}

@media (max-width: 900px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-form-grid { grid-template-columns: 1fr; }
  .profile-span-2 { grid-column: auto; }
}

/* ── Users / access ── */
.users-table .users-access-cell {
  min-width: 12rem;
}
.users-access-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}
.access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem 1.25rem;
  margin-top: 0.75rem;
}
.access-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.access-group-title {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}
.access-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
}
.access-check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #2f6db5;
}
.access-grid.is-admin-locked {
  opacity: 0.72;
}
.user-form .panel-head {
  margin-bottom: 0.75rem;
}

@keyframes feedPulse {
  0% { box-shadow: none; }
  100% { box-shadow: none; }
}

/* ── Products ── */
.products-filter input[type="search"],
.products-filter input[type="text"],
.products-filter input[type="date"],
.products-filter select {
  border: none;
  background: var(--control-bg);
  height: 2.35rem;
  padding: 0 0.65rem;
  min-width: 140px;
  box-sizing: border-box;
  width: 100%;
}

.products-filters-panel {
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.products-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-end;
}

.products-filter label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 140px;
  flex: 1 1 140px;
}

.products-filter .filter-searchable {
  flex: 1 1 180px;
  min-width: 180px;
}

/* Analytics — marketplace multi-select dropdown */
.mp-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 200px;
  flex: 1 1 200px;
  max-width: 260px;
}

.mp-filter-caption {
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mp-filter {
  position: relative;
}

.mp-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 8px;
  background: var(--control-bg, #fff);
  color: var(--ink, #1a1d21);
  font-size: 0.84rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mp-filter-trigger:hover {
  border-color: var(--accent, #2f6db5);
}

.mp-filter-trigger:focus-visible {
  outline: none;
  border-color: var(--accent, #2f6db5);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, 0.18);
}

.mp-filter.is-open .mp-filter-trigger {
  border-color: var(--accent, #2f6db5);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, 0.12);
}

.mp-filter-trigger-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-filter-chevron {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--ink-soft, #6b7280);
  border-bottom: 1.5px solid var(--ink-soft, #6b7280);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}

.mp-filter.is-open .mp-filter-chevron {
  transform: rotate(-135deg) translateY(2px);
}

.mp-filter-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 240px;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.mp-filter-panel[hidden] {
  display: none !important;
}

.mp-filter-toolbar {
  padding: 0.5rem 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border, #e8ecf0);
  background: var(--control-bg, #f8fafc);
}

.mp-filter-search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 6px;
  font-size: 0.8rem;
  background: #fff;
}

.mp-filter-search:focus {
  outline: none;
  border-color: var(--accent, #2f6db5);
  box-shadow: 0 0 0 2px rgba(47, 109, 181, 0.15);
}

.mp-filter-actions {
  display: flex;
  gap: 0.35rem;
}

.mp-filter-action {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 999px;
  background: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft, #64748b);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mp-filter-action:hover {
  border-color: var(--accent, #2f6db5);
  color: var(--accent, #2f6db5);
  background: var(--accent-soft, #eef4fb);
}

.mp-filter-options {
  overflow-y: auto;
  padding: 0.35rem 0;
  max-height: 200px;
  text-align: left;
}

.products-filter .mp-filter-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
  flex: none;
  padding: 0.4rem 0.65rem;
  margin: 0;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--ink, #1a1d21);
  text-transform: none;
  letter-spacing: normal;
  text-align: left;
  transition: background 0.12s ease;
}

.mp-filter-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  margin: 0;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--ink, #1a1d21);
  text-align: left;
  transition: background 0.12s ease;
}

.mp-filter-option:hover {
  background: var(--accent-soft, #eef4fb);
}

.mp-filter-option.is-hidden {
  display: none;
}

.mp-filter-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.mp-filter-check {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--border, #cbd5e1);
  border-radius: 4px;
  background: #fff;
  position: relative;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.mp-filter-option input:checked + .mp-filter-check {
  border-color: var(--accent, #2f6db5);
  background: var(--accent, #2f6db5);
}

.mp-filter-option input:checked + .mp-filter-check::after {
  content: '';
  position: absolute;
  left: 0.28rem;
  top: 0.1rem;
  width: 0.28rem;
  height: 0.5rem;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.mp-filter-option-text {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.mp-filter-empty {
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
}

.products-filter .btn {
  height: 2.35rem;
  padding: 0 0.85rem;
  display: inline-flex;
  align-items: center;
}

.category-cell {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
}

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

.category-edit-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  font-weight: 550;
  text-align: left;
}

.category-edit-trigger:hover #category-label {
  text-decoration: underline;
}

.category-edit-hint {
  flex-shrink: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-weight: 600;
  background: var(--control-btn-bg);
  padding: 0.15rem 0.4rem;
}

.category-edit-trigger:hover .category-edit-hint {
  background: #101010;
  color: #fff;
}

.category-modal {
  max-width: 480px;
}

.category-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.category-form input[type="text"] {
  height: 2.35rem;
  padding: 0 0.65rem;
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

.category-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.category-form-error {
  color: var(--danger) !important;
  margin: 0;
}

.products-table .set-consist-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.products-table .col-thumb { width: 64px; }

.page-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 1rem;
  border-bottom: 1px solid #e4e4e4;
}
.page-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 550;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.page-tab:hover { color: var(--ink); }
.page-tab.is-active {
  color: var(--ink);
  border-bottom-color: #2f6db5;
}
.page-tab-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: #f0f0f0;
  padding: 0.1rem 0.4rem;
}
.page-tab.is-active .page-tab-count {
  background: #e8eef8;
  color: #2f6db5;
}

.set-editor-panel { position: relative; }
.set-editor-search {
  position: relative;
  margin: 0 0 0.85rem;
  max-width: 480px;
}
.set-search-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.set-search-label input {
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d6d6d6;
  background: #fff;
  color: var(--ink);
}
.set-search-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border: 1px solid #d6d6d6;
  max-height: 320px;
  overflow: auto;
}
.set-search-empty { padding: 0.75rem; }
.set-search-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
}
.set-search-item:hover { background: #f7f7f7; }
.set-search-item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.set-search-thumb {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: #ececec;
  overflow: hidden;
}
.set-search-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.set-search-thumb-empty {
  display: block;
  width: 100%;
  height: 100%;
}
.set-search-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  line-height: 1.25;
}
.set-search-meta strong {
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.set-items-table .col-actions {
  width: 88px;
  text-align: right;
}
.set-editor-status {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
}
.product-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  display: block;
  background: #ececec;
}
.product-thumb-empty { background: #ececec; }
.product-row { cursor: pointer; }
.product-row:hover td { background: #f7f7f7; }
.product-title-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.product-title-link:hover { text-decoration: underline; }
.product-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}
.product-title-row .product-title-link {
  flex: 1;
  min-width: 0;
}
.listing-ext-link {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  color: var(--ink-soft);
  border-radius: 2px;
  text-decoration: none;
}
.listing-ext-link:hover {
  color: var(--ink);
  background: var(--control-bg);
}
.product-meta { font-size: 0.75rem; margin-top: 0.15rem; }
.sku-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listings-table td,
.listings-table th {
  vertical-align: middle;
}
.listings-table .sku-cell,
.listings-table .stock-cell {
  max-width: none;
  overflow: visible;
  text-overflow: unset;
}
.listings-table .sku-line,
.listings-table .stock-line {
  line-height: 1.35;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}
.listings-table .col-stock {
  text-align: right;
  min-width: 64px;
}
.listings-table .stock-ok { color: var(--ok); font-weight: 600; }
.listings-table .stock-out { color: var(--danger); font-weight: 600; }
.empty-cell { text-align: center; color: var(--ink-soft); padding: 2rem !important; }

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft, #fde8e8); color: var(--danger, #c0392b); }
.badge-muted { background: #eef2f5; color: var(--ink-soft); }
.badge-set {
  background: #e8eef8;
  color: #2f6db5;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.page-head-badges {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  flex-shrink: 0;
}
.set-items-table .col-thumb { width: 64px; }
.product-meta .badge-set {
  display: inline-block;
  margin-top: 0.15rem;
}

.stocks-table .col-thumb { width: 64px; }
.stocks-table .stock-product-cell { min-width: 280px; max-width: 420px; }
.stock-row { cursor: pointer; }
.stock-row:hover td { background: #f7f7f7; }
.stocks-table .stock-ok { color: var(--ok); font-weight: 600; }
.stocks-table .stock-out { color: var(--danger, #c0392b); font-weight: 600; }

.set-consist-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.set-consist-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0;
  border-top: 1px solid #ececec;
}
.set-consist-item:first-child { border-top: none; padding-top: 0; }
.set-consist-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f0f0;
}
.set-consist-thumb-empty {
  display: inline-block;
}
.set-consist-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.set-consist-sku {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.set-consist-title {
  font-size: 0.8rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
a.set-consist-title:hover { text-decoration: underline; }
.prices-table .col-thumb { width: 56px; }
.prices-table .col-product { min-width: 200px; max-width: 280px; }
.prices-table .col-rrp,
.prices-table .col-cost { min-width: 78px; }
.prices-table .col-mp {
  text-align: center;
  min-width: 72px;
  vertical-align: top;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.price-row:hover td { background: #f7f7f7; }
.price-row.is-saving td { opacity: 0.7; }
.price-row.is-saved td { background: #eef8f0; }
.price-row.is-error td { background: #fde8e8; }

.price-input {
  width: 72px;
  text-align: right;
  font-size: 0.84rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
}
.price-input:hover,
.price-input:focus {
  border-color: #c8c8c8;
  background: #fff;
  outline: none;
}

.mp-price-val {
  font-weight: 600;
  font-size: 0.84rem;
  line-height: 1.2;
}
.mp-price-fx {
  font-size: 0.62rem;
  line-height: 1.1;
}
.mp-price-pct {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.1;
}
.mp-price-pct.is-below,
.prices-table td.price-below .mp-price-pct {
  color: #c0392b;
}
.prices-table td.price-below {
  background: #fdecea;
}
.mp-price-pct.is-above {
  color: #168a45;
}

.listings-table .col-thumb { width: 56px; }
.listings-table .col-product { min-width: 220px; max-width: 320px; }
.listings-table .col-mp {
  text-align: center;
  min-width: 56px;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.listings-table th.col-mp.is-provisional,
.listings-table td.col-mp.is-provisional {
  background: #f0f0f0;
  color: #9aa3ad;
  opacity: 0.72;
}
.listings-table th.col-mp.is-provisional .listings-mp-name {
  color: #9aa3ad;
}
.listings-table td.col-mp.is-provisional .listing-mark {
  color: #b0b6be;
}
.kpi-feed-card.is-provisional {
  opacity: 0.65;
  background: #f0f0f0;
}
.kpi-feed-value.is-provisional {
  color: #9aa3ad;
  font-size: 0.72rem;
  text-transform: lowercase;
}
.listings-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.listings-kpi {
  display: block;
  background: var(--surface);
  padding: 0.75rem 0.85rem 0.8rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.listings-kpi:hover {
  background: #f7f8fa;
}
.listings-kpi.is-active {
  border-bottom-color: #2f6db5;
  background: #f3f7fb;
}
.listings-kpi header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.listings-kpi-mp {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.listings-kpi-mp .mp-icon {
  width: 22px;
  height: 22px;
  font-size: 0.58rem;
  flex-shrink: 0;
}
.listings-kpi-label {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listings-kpi-pct {
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  flex-shrink: 0;
}
.listings-kpi-pct.is-high { color: #168a45; }
.listings-kpi-pct.is-mid { color: #b45309; }
.listings-kpi-pct.is-low { color: #b42318; }
.listings-kpi-bar {
  height: 3px;
  background: #e8ecf0;
  margin-bottom: 0.4rem;
  overflow: hidden;
}
.listings-kpi-bar > span {
  display: block;
  height: 100%;
  background: #2f6db5;
}
.listings-kpi-meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.prices-kpi {
  cursor: default;
}
.prices-kpi:hover {
  background: var(--surface);
}
.prices-kpi-avg {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.prices-kpi-avg.is-below { color: #b42318; }
.prices-kpi-avg.is-above { color: #168a45; }
.prices-kpi-avg.is-flat { color: var(--ink-soft); }
@media (max-width: 700px) {
  .listings-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.listings-mp-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  line-height: 1.1;
}
.listings-mp-head .mp-icon {
  margin-right: 0;
  width: 24px;
  height: 24px;
  font-size: 0.62rem;
}
.listings-mp-name {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  max-width: 64px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listing-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  line-height: 0;
}
.listing-yes { color: #168a45; }
.listing-no { color: #c0392b; opacity: 0.85; }

.order-row { cursor: pointer; }
.order-row:hover td { background: #f7f7f7; }
.orders-table .mp-cell,
.order-facts .mp-cell {
  white-space: nowrap;
}
.orders-table .nowrap { white-space: nowrap; }

.order-detail {
  margin-bottom: 1.25rem;
}
.order-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}
.order-facts .fact-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.order-facts strong {
  font-size: 1.05rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
}
.order-attrs {
  margin-bottom: 0;
}
.orders-items-table .col-thumb { width: 64px; }

.returns-table .mp-cell,
.returns-table .nowrap { white-space: nowrap; }
.return-source {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
}
.return-reason-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}

@media (max-width: 900px) {
  .order-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}

.back-link {
  display: inline-block;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.back-link:hover { color: var(--ink); }

.product-detail {
  display: grid;
  grid-template-columns: minmax(240px, 380px) 1fr;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}
.product-hero {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #ececec;
  display: block;
}
.product-hero-empty {
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.product-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.product-thumb-btn {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.7;
}
.product-thumb-btn.is-active,
.product-thumb-btn:hover { opacity: 1; }
.product-thumb-btn img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #ececec;
}

.product-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}
.product-facts .fact-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.product-facts strong {
  font-size: 1.15rem;
  font-weight: 650;
}

.product-attrs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin: 0 0 1rem;
}
.product-attrs div { margin: 0; }
.product-attrs dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 0.15rem;
}
.product-attrs dd { margin: 0; font-weight: 550; }

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tag {
  background: #f0eeeb;
  color: var(--ink);
  font-size: 0.75rem;
  padding: 0.2rem 0.45rem;
}

.product-body {
  padding: 0 1rem 1rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 72ch;
}
.product-body img { max-width: 100%; height: auto; }
.product-body p { margin: 0 0 0.75rem; }

@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; }
  .product-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Global system alerts ── */
.sys-alert {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 1200;
  width: min(360px, calc(100vw - 2rem));
  padding: 0.85rem 0.95rem;
  color: #fff;
  animation: sysAlertIn 0.28s ease;
}
.sys-alert-danger {
  background: var(--danger);
}
.sys-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.sys-alert-head strong {
  font-size: 0.92rem;
  font-weight: 650;
}
.sys-alert-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
  opacity: 0.85;
}
.sys-alert-close:hover { opacity: 1; }
.sys-alert-list {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sys-alert-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sys-alert-label {
  font-weight: 600;
  font-size: 0.88rem;
}
.sys-alert-note {
  font-size: 0.78rem;
  opacity: 0.9;
  line-height: 1.35;
}
.sys-alert-link {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sys-alert-link:hover { opacity: 0.9; }

@keyframes sysAlertIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ── Customer Care ── */
.care-table .care-row { cursor: pointer; }
.care-table .care-row:hover { background: #f7f8fa; }
.care-table .care-row.is-unread td { background: #fffaf0; }
.care-table .care-row.is-unread:hover td { background: #fff4e0; }
.care-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}
.care-dot.is-done {
  background: #c5ccd6;
  box-shadow: none;
}
.care-mp {
  white-space: nowrap;
  vertical-align: middle;
}
.care-mp-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
}
.care-mp .mp-icon {
  margin-right: 0;
}
.care-mp-name {
  line-height: 1.2;
}
.care-title {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}
.care-title:hover { text-decoration: underline; }
.care-sub { margin-top: 0.15rem; font-size: 0.82rem; }
.care-preview {
  max-width: 28rem;
  line-height: 1.35;
  color: var(--ink-soft, #64748b);
}
.care-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 960px) {
  .care-layout { grid-template-columns: 1fr; }
}
.care-thread-panel { padding: 0; overflow: hidden; }
.care-thread {
  max-height: min(62vh, 640px);
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: linear-gradient(180deg, #f7f8fa 0%, #fff 40%);
}
.care-bubble {
  max-width: min(72%, 40rem);
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--color-border, #e2e8f0);
  background: #fff;
}
.care-bubble header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-soft, #64748b);
}
.care-bubble-body {
  word-break: break-word;
  line-height: 1.45;
  font-size: 0.92rem;
}
.care-bubble-body p {
  margin: 0 0 0.55em;
}
.care-bubble-body p:last-child {
  margin-bottom: 0;
}
.care-bubble-body a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.care-bubble-body ul,
.care-bubble-body ol {
  margin: 0.35em 0 0.55em 1.1rem;
  padding: 0;
}
.care-bubble.is-shop .care-bubble-body a {
  color: #fff;
}
.care-bubble.is-shop {
  align-self: flex-end;
  background: #111;
  color: #fff;
  border-color: #111;
}
.care-bubble.is-shop header { color: rgba(255,255,255,0.7); }
.care-bubble.is-operator {
  align-self: flex-start;
  background: #eef2ff;
  border-color: #d9e0ff;
}
.care-bubble.is-customer {
  align-self: flex-start;
}
.care-reply,
.care-resolve {
  border-top: 1px solid var(--color-border, #e2e8f0);
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}
.care-reply label,
.care-resolve label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.care-reply textarea,
.care-resolve select {
  width: 100%;
  border: 1px solid var(--ctl-border, #d9dee5);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  resize: vertical;
}
.care-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.care-side { padding: 1rem; }
.care-side h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}
.care-meta {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.55rem 0.75rem;
  margin: 0;
  font-size: 0.9rem;
}
.care-meta-wide { padding: 0 1rem 1rem; }
.care-meta dt {
  margin: 0;
  color: var(--ink-soft, #64748b);
}
.care-meta dd { margin: 0; }
.care-meta code {
  font-size: 0.78rem;
  word-break: break-all;
}
.care-related {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.care-related a {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}
.care-related a:hover { text-decoration: underline; }

/* ── Marketplace dashboard page ── */
.mp-name-link {
  font-weight: 550;
  color: inherit;
  text-decoration: none;
}
.mp-name-link:hover { text-decoration: underline; }

.mp-page-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.mp-page-title .mp-icon {
  width: 1.7rem;
  height: 1.7rem;
  font-size: 0.72rem;
}

.mp-chart-wrap {
  position: relative;
  padding: 0.75rem 1rem 1rem;
}
#mp-orders-chart {
  display: block;
  width: 100%;
  height: 280px;
  cursor: crosshair;
}
.mp-chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 10.5rem;
  padding: 0.5rem 0.65rem;
  background: #1f2933;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-8px, -12px);
}
.mp-chart-tooltip strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.mp-chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
}
.mp-chart-tooltip-row span:first-child {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #d5dce3;
}
.mp-chart-tooltip-row b { font-variant-numeric: tabular-nums; }
.mp-chart-tooltip .mp-chart-swatch { margin-right: 0; }
.mp-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.mp-chart-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.2rem;
  margin-right: 0.35rem;
  vertical-align: middle;
  background: #64748b;
}
.mp-chart-swatch.is-completed { background: #1f7a4d; }
.mp-chart-swatch.is-open { background: #2f6db5; }
.mp-chart-swatch.is-cancelled { background: #b42318; }

.mp-health-note {
  padding: 0 1rem 0.5rem;
  font-size: 0.85rem;
}
.mp-health-region-label {
  padding: 0 1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.mp-health-line {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0 1rem 1.1rem;
}
.mp-health-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 6.4rem;
  padding: 0.55rem 0.6rem 0.6rem;
  background: #f4f5f7;
  text-align: center;
}
.mp-health-name {
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
}
.mp-ahr-pill {
  display: inline-block;
  padding: 0.14rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 650;
  text-align: center;
  color: #fff;
  background: #94a3b8;
  white-space: nowrap;
}
.mp-ahr-pill.is-healthy { background: #557e13; }
.mp-ahr-pill.is-atrisk { background: #e47911; }
.mp-ahr-pill.is-unhealthy { background: #b42318; }
.mp-ahr-pill.is-unknown { background: #94a3b8; }
.mp-ahr-rating {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0d3b45;
}
.mp-health-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.65rem;
  padding: 0 1rem 1.1rem;
  border-top: 1px solid var(--line);
}
.mp-health-metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafb;
  border: 1px solid #e8edf1;
}
.mp-health-metric-label {
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink-soft);
}
.mp-health-metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0d3b45;
}
.mp-health-metric-value.is-good { color: #557e13; }
.mp-health-metric-value.is-warn { color: #b45309; }
.mp-health-metric-value.is-bad { color: #b42318; }
.mp-health-metric-pill {
  align-self: flex-start;
  margin-top: 0.15rem;
}
.mp-health-metric-level {
  font-size: 0.72rem;
}

.ads-kpi-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.ads-sort-th .ads-sort-link {
  color: inherit;
  text-decoration: none;
  font-weight: 650;
  white-space: nowrap;
}
.ads-sort-th .ads-sort-link:hover {
  text-decoration: underline;
}
.ads-sort-th.is-active .ads-sort-link {
  color: var(--ink);
}
.ads-note { margin: 0 0 0.85rem; }
.ads-note.is-updating { color: var(--ink); }
.ads-note.is-updating::before {
  content: '';
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
  border-top-color: var(--ink);
  vertical-align: -0.05rem;
  animation: ads-spin 0.7s linear infinite;
}
@keyframes ads-spin { to { transform: rotate(360deg); } }
.ads-filter { padding: 0 1rem 0.85rem; }
.ads-table { min-width: 1080px; }
.ads-name {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ads-type {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  background: #eef2f5;
}
.ads-type-sp { background: #e6f4ec; color: var(--ok); }
.ads-type-sb { background: #eef2ff; color: #3730a3; }
.ads-type-sd { background: #fff4e5; color: var(--warn); }
.ads-state { font-size: 0.78rem; }
.ads-state.is-on { color: var(--ok); font-weight: 650; }
.ads-state.is-off { color: var(--ink-soft); }
.ads-footnote { padding: 0.65rem 1rem 1rem; font-size: 0.82rem; }
.ads-can-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  padding: 0 1rem 1.1rem;
}
.ads-can-grid h3 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.ads-can-grid ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}
@media (max-width: 1100px) {
  .ads-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ads-can-grid { grid-template-columns: 1fr; }
}

.public-body {
  min-height: 100vh;
  padding: 2rem 1.25rem 4rem;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(237, 233, 228, 0.95), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(243, 243, 243, 0.95), transparent 50%),
    var(--bg);
}

.public-document {
  width: min(820px, 100%);
  margin: 0 auto;
  background: var(--surface);
  padding: 2rem 2.25rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}

.public-document-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.public-document-logo {
  display: block;
  margin-bottom: 1rem;
}

.public-document h1 {
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
  line-height: 1.25;
}

.public-document-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.public-document section + section {
  margin-top: 1.35rem;
}

.public-document h2 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}

.public-document p,
.public-document li {
  line-height: 1.6;
  color: var(--ink);
}

.public-document ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.public-card-shell {
  min-height: calc(100vh - 6rem);
  display: grid;
  place-items: center;
}

.public-card {
  width: min(520px, 100%);
  background: var(--surface);
  padding: 2rem 1.75rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}

.public-card h1 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
}

.public-card p {
  margin: 0;
  line-height: 1.6;
  color: var(--ink-soft);
}

.public-card-note {
  margin-top: 1rem !important;
  font-size: 0.9rem;
}

.public-meta-list {
  margin: 1rem 0 0;
  display: grid;
  gap: 0.75rem;
}

.public-meta-list div {
  display: grid;
  gap: 0.15rem;
}

.public-meta-list dt {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.public-meta-list dd {
  margin: 0;
  font-weight: 600;
}

/* Selection bar for CSV export */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .5rem 1rem;
  background: var(--bg-alt, #f5f6f8);
  border-bottom: 1px solid var(--border, #e2e4e8);
}
.selection-bar-all { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.col-check { width: 2rem; text-align: center; }


/* SKU mapping editor */
.sku-map-alert-panel { margin-bottom: 1rem; }
.sku-map-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.25rem;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  color: #9a3412;
  font-size: 0.9rem;
}
.sku-map-alert strong { font-variant-numeric: tabular-nums; }
.sku-map-filters { align-items: flex-end; }
.sku-map-add-panel { margin-bottom: 1rem; }
.sku-map-mp-input {
  width: auto;
  min-width: 16ch;
  max-width: none;
  box-sizing: content-box;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 6px;
  font-size: 0.84rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--control-bg, #fff);
}
.sku-map-mp-input:focus {
  outline: none;
  border-color: var(--accent, #2f6db5);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, 0.15);
}
.sku-map-row.is-stock-unmapped { background: #fffbeb; }
.sku-map-row.is-skipped { background: #f8fafc; }

.sku-map-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  padding: 0 1.25rem 1.25rem;
}
.sku-map-add-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.sku-map-add-form input[type="text"] {
  min-width: 22ch;
  width: auto;
  max-width: none;
  box-sizing: content-box;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.sku-map-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  font-weight: 500 !important;
  padding-bottom: 0.35rem;
}
.sku-map-editor {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  min-width: max-content;
}
.sku-map-our-wrap { position: relative; min-width: max-content; }
.sku-map-our-input {
  width: auto;
  min-width: 16ch;
  max-width: none;
  box-sizing: content-box;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 6px;
  font-size: 0.84rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--control-bg, #fff);
}
.sku-map-our-input:focus {
  outline: none;
  border-color: var(--accent, #2f6db5);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, 0.15);
}
.sku-map-suggest {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  max-width: 360px;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border, #d8dde3);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 0.25rem;
}
.sku-map-suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}
.sku-map-suggest-item:hover { background: var(--accent-soft, #eef4fb); }
.sku-map-suggest-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sku-map-row-status,
.sku-map-add-status { font-size: 0.75rem; margin-left: 0.35rem; }
.sku-map-row-status.is-ok,
.sku-map-add-status.is-ok { color: var(--ok, #15803d); }
.sku-map-row-status.is-error,
.sku-map-add-status.is-error { color: var(--danger, #b91c1c); }
.sku-map-table .sku-map-our-cell {
  min-width: max-content;
  white-space: nowrap;
}
.sku-map-table .sku-cell {
  max-width: none;
  overflow: visible;
  text-overflow: unset;
  white-space: nowrap;
}
.sku-map-table code {
  font-size: 0.8rem;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: visible;
  word-break: keep-all;
}
