/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f1f5f9;
  --accent: #2563eb;
  --accent-weak: #e0e7ff;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shell-gutter: 12px;
}

* {
  box-sizing: border-box;
}

/* Match .hidden: native [hidden] must beat high-specificity display utilities (.btn, .utility-bar …) */
[hidden] {
  display: none !important;
}

body.pp-body {
  margin: 0;
  font-family: "Inter", "SF Pro Text", system-ui, -apple-system, sans-serif;
  background: #2d457f;
  color: var(--ink);
  padding: 0 var(--shell-gutter);
}

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

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding-left: 221px;
  padding-top: 48px;
  background: transparent;
  transition: margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-bar {
  position: fixed;
  top: 0;
  left: var(--shell-gutter);
  right: var(--shell-gutter);
  height: 48px;
  background: #2d457f;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8fafc;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.header-logo-mark {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(248, 250, 252, 0.1);
  border: 1px solid rgba(248, 250, 252, 0.2);
  border-radius: 10px;
  padding: 6px 10px;
  min-width: 420px;
  color: #cbd5f5;
  font-size: 12.5px;
  position: relative;
  z-index: 46;
}

.header-search > * {
  position: relative;
  z-index: 47;
}

.header-search.is-open {
  background: #ffffff;
  border-color: #111827;
  color: #111827;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  border-radius: 12px;
}

.header-search input {
  border: none;
  background: transparent;
  color: inherit;
  outline: none;
  width: 100%;
}

.header-search input::placeholder {
  color: #e2e8f0;
}

.header-search.is-open input::placeholder {
  color: #9ca3af;
}

.header-search-icon {
  width: 16px;
  height: 16px;
  color: #e2e8f0;
  display: grid;
  place-items: center;
}

.header-search.is-open .header-search-icon {
  color: #6b7280;
}

.header-search-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-search-shortcut {
  margin-left: auto;
  font-size: 11px;
  background: rgba(15, 23, 42, 0.6);
  border: none;
  color: #e2e8f0;
  padding: 2px 5px;
  border-radius: 6px;
}

.header-search.is-open .header-search-shortcut {
  background: #f3f4f6;
  color: #6b7280;
}

.header-search-shortcut + .header-search-shortcut {
  margin-left: 0;
}

.header-search-dropdown {
  position: absolute;
  top: -6px;
  left: -12px;
  right: -12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 48px 0 0;
  z-index: 44;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.header-search.is-open .header-search-dropdown {
  border-radius: 12px;
}

.header-search-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 12px 8px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
}

.header-search-pill {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  border-radius: 10px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.header-search-pill.is-active,
.header-search-pill:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #1d4ed8;
}

.header-search-dropdown-list {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 0 12px 6px;
}

.header-search-group {
  display: grid;
  gap: 4px;
}

.header-search-group-label {
  color: #6b7280;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 6px;
}

.header-search-item {
  background: transparent;
  border: 1px solid transparent;
  color: #111827;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
}

.header-search-item:hover,
.header-search-item.is-active {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.header-search-item-title {
  display: block;
  font-weight: 600;
}

.header-search-item-media {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  color: #6b7280;
  font-weight: 600;
  font-size: 12px;
}

.header-search-item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-search-item-placeholder {
  font-size: 12px;
}

.header-search-item-meta {
  display: grid;
  gap: 2px;
}

.header-search-item-meta.is-tight {
  gap: 0;
}

.header-search-item-subtitle {
  color: #6b7280;
  font-size: 11.5px;
}

.header-search-ai {
  margin-top: 8px;
  width: 100%;
  background: #f1f5f9;
  border: none;
  border-top: 1px solid #e5e7eb;
  color: #111827;
  border-radius: 0 0 14px 14px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-search-dropdown.has-results .header-search-ai {
  margin-top: 6px;
}

.header-search-ai.is-active,
.header-search-ai:hover {
  background: #e2e8f0;
}

.header-search-ai.is-loading {
  opacity: 0.7;
  cursor: progress;
}

.header-search-ai-spinner {
  margin-left: auto;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: #2563eb;
  animation: header-search-spin 0.8s linear infinite;
  opacity: 0;
}

.header-search-ai.is-loading .header-search-ai-spinner {
  opacity: 1;
}

@keyframes header-search-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.header-search-ai-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #1d4ed8;
}


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

.sidebar-corner {
  position: fixed;
  top: 48px;
  left: var(--shell-gutter);
  width: 16px;
  height: 16px;
  background: #2d457f;
  border-bottom-right-radius: 16px;
  z-index: 29;
}

.sidebar {
  position: fixed;
  left: var(--shell-gutter);
  top: 48px;
  width: 221px;
  height: calc(100vh - 48px);
  background: #e5e7eb;
  color: #1f2933;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateX(0);
  transition: transform 0.2s ease;
  z-index: 30;
  border-top-left-radius: 16px;
  border-top-right-radius: 0;
}

.sidebar-footer {
  margin-top: auto;
}

.user-menu {
  position: relative;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #1f2933;
  font-weight: 600;
  cursor: pointer;
}

.user-menu > summary {
  list-style: none;
}

.user-menu > summary::-webkit-details-marker {
  display: none;
}

.user-menu-panel {
  position: absolute;
  top: 44px;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  min-width: 140px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 40;
}

.user-menu[open] .user-menu-panel {
  display: grid;
}

.user-menu-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: #0f172a;
}

.user-menu-item:hover {
  background: #f1f5f9;
}

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

.brand-text {
  flex: 1;
}

.icon-button {
  border: none;
  background: #e2e8f0;
  color: #334155;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-button svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  background: #cbd5f5;
}

.icon-button-light {
  background: #ffffff;
  border: 1px solid var(--line);
  color: #334155;
}

.icon-button-light:hover {
  background: #f8fafc;
}

.icon-button-pinned {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #b45309;
}

.icon-button-pinned:hover {
  background: #fde68a;
}

.info-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.info-button svg .info-dot {
  fill: currentColor;
  stroke: none;
}

.item-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-details {
  min-width: 0;
}

.favorite-toggle-form {
  display: inline-block;
}

.favorite-toggle {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.favorite-toggle:hover {
  background: #f8fafc;
}

.favorite-toggle.is-active {
  background: #fef3c7;
  border-color: #fcd34d;
}

.favorite-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.favorite-toggle-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: #64748b;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorite-toggle.is-active .favorite-toggle-icon svg {
  fill: #f59e0b;
  stroke: #f59e0b;
}

.hamburger-button {
  display: none;
}

.app-shell.is-collapsed .hamburger-button {
  display: grid;
}

.icon {
  transition: transform 0.2s ease;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #1f2933;
}

.brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: #6b7280;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  display: grid;
  gap: 2px;
  position: relative;
}

.nav-parent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #1f2933;
  font-size: 13.5px;
  font-weight: 450;
}

.nav-parent:hover {
  background: #f1f5f9;
}

.nav-parent:active {
  background: #f8fafc;
}

.nav-parent.is-active {
  background: transparent;
  color: #1f2933;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #64748b;
}

.nav-parent.is-active .nav-icon {
  color: #64748b;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-submenu {
  display: none;
  gap: 2px;
  padding-left: 0;
  padding-top: 0;
  position: relative;
  overflow: hidden;
}

.nav-section.is-active .nav-submenu {
  display: grid;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 6px 8px 6px 38px;
  border-radius: 8px;
  color: #475569;
  font-size: 13.5px;
  font-weight: 450;
  position: relative;
}

.nav-section-single {
  gap: 0;
}

.nav-section-single.is-active .nav-parent {
  background: #d1d5db;
  color: #111827;
}

.nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-item:active {
  background: #f8fafc;
}

.nav-item.is-active {
  background: #d1d5db;
  color: #111827;
  font-weight: 450;
}

.nav-nested {
  margin: 0;
  padding: 0;
}

.nav-nested-toggle {
  display: block;
  padding: 6px 8px 6px 38px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 450;
  color: #475569;
  cursor: pointer;
  list-style: none;
  position: relative;
  user-select: none;
}

.nav-nested-toggle::-webkit-details-marker {
  display: none;
}

.nav-nested-toggle::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid #475569;
  border-bottom: 1.5px solid #475569;
  transform: translateY(-50%) rotate(-45deg);
  transition: transform 0.15s ease;
}

.nav-nested[open] > .nav-nested-toggle::after {
  transform: translateY(-65%) rotate(45deg);
}

.nav-nested-toggle:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-nested-items {
  display: grid;
  gap: 2px;
  padding-top: 2px;
}

.nav-nested-items .nav-item {
  padding-left: 50px;
}

.nav-mini {
  margin-top: 12px;
  padding: 0 4px;
  display: grid;
  gap: 4px;
}

.nav-mini-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.nav-mini-title:hover {
  color: #64748b;
}

.nav-mini-list {
  display: grid;
  gap: 2px;
}

.nav-mini-item {
  display: block;
  width: 100%;
  padding: 6px 8px 6px 20px;
  border-radius: 8px;
  color: #475569;
  font-size: 12.5px;
  font-weight: 450;
}

.nav-mini-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-mini-empty {
  padding: 4px 8px 6px 20px;
  font-size: 12px;
  color: #94a3b8;
}


.sidebar-hover-zone {
  display: none;
}

.app-shell.is-collapsed .sidebar {
  transform: translateX(-100%);
  visibility: hidden;
  pointer-events: none;
}

.app-shell.is-collapsed {
  padding-left: 0;
}

.app-shell.is-collapsed .sidebar-hover-zone {
  display: block;
  position: fixed;
  left: var(--shell-gutter);
  top: 48px;
  width: 12px;
  height: calc(100vh - 48px);
  z-index: 25;
}

.app-shell.is-collapsed.is-peeking .sidebar,
.app-shell.is-collapsed .sidebar-hover-zone:hover ~ .sidebar,
.app-shell.is-collapsed .sidebar:hover {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.app-shell.is-collapsed .sidebar-hover-zone:hover ~ .sidebar .icon-button .icon,
.app-shell.is-collapsed .sidebar:hover .icon-button .icon {
  transform: rotate(180deg);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 0;
  padding-top: 0;
  background: #f6f7f9;
  border-top-right-radius: 16px;
  /* visible so topbar/utility dropdowns (filters, menus) are not clipped at this edge */
  overflow: visible;
  position: relative;
  z-index: 20;
  min-height: calc(100vh - 48px);
}

.app-shell.is-collapsed .main {
  margin-left: 0;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.topbar-title h1 {
  margin: 0;
  font-size: 18px;
}

.topbar-title .eyebrow {
  margin: 0;
}

.topbar-subtitle {
  margin: 0;
  font-size: 13px;
  font-weight: normal;
  color: var(--text-muted, #64748b);
  max-width: 520px;
}

.view-switcher {
  position: relative;
  display: inline-flex;
}

.view-switcher > summary {
  list-style: none;
}

.view-switcher > summary::-webkit-details-marker {
  display: none;
}

.view-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.view-caret {
  font-size: 18px;
  color: var(--muted);
  line-height: 1;
}

.view-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  min-width: 220px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06);
  display: none;
  z-index: 40;
}

.view-switcher[open] .view-menu {
  display: flex;
  flex-direction: column;
}

.action-menu {
  position: relative;
  display: inline-flex;
}

.action-menu > summary {
  list-style: none;
}

.action-menu > summary::-webkit-details-marker {
  display: none;
}

.action-menu-right .view-menu {
  right: 0;
  left: auto;
}

.action-menu-panel {
  min-width: 200px;
  padding: 4px;
}

.action-menu-panel .action-menu-item {
  width: 100%;
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: 8px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0f172a;
  cursor: pointer;
}

.action-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.action-menu-trigger > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.action-menu-trigger .view-caret {
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.action-menu-panel .action-menu-item.btn {
  border: none;
}

.action-menu-panel .action-menu-item:hover {
  background: #f1f5f9;
}


.view-menu-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink, #0f172a);
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.1s ease;
}

.view-menu-item:hover {
  background: var(--soft, #f1f5f9);
}

.view-menu-item.is-active {
  font-weight: 600;
  color: var(--accent, #3b82f6);
}

.view-menu-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, #3b82f6);
}

.view-menu-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #64748b);
  padding: 6px 10px 2px;
  user-select: none;
}

.view-menu-divider {
  height: 1px;
  background: var(--line, #e2e8f0);
  margin: 4px 6px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.filters-inline-main {
  flex: 1;
}

.search-flex {
  flex: 1;
  max-width: none;
}

.utility-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px 6px 24px;
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 -24px -24px;
}

.table-selection-row {
  background: #f8fafc;
}

.table-selection-row th {
  padding: 12px 14px;
}

/* Sibling of .table-wrap: same padding as former <th>, dropdown not clipped by overflow-x */
.table-selection-row--outside {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.selection-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 16px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.selection-bar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: normal;
}

.selection-clear {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.selection-clear-icon {
  font-size: 12px;
  line-height: 1;
}

.selection-trigger {
  text-transform: none;
  font-size: 12px;
  line-height: 1.2;
}

.selection-trigger .view-caret {
  font-size: 16px;
  line-height: 1;
}

.selection-toggle {
  position: relative;
  display: inline-flex;
}

.selection-toggle .selection-menu {
  display: none;
  position: absolute;
  top: 28px;
  left: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  min-width: 220px;
  box-shadow: var(--shadow);
  z-index: 40;
}

.selection-toggle[open] .selection-menu {
  display: grid;
  gap: 6px;
}

.selection-toggle > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.selection-menu {
  min-width: 220px;
}
.selection-menu .view-menu-item {
  display: block;
}

.utility-bar .filters-inline {
  width: 100%;
  gap: 12px;
}

/* Same visual weight as .facet-trigger (Status, Vendor, …) in this row */
.utility-bar .filters-inline > .btn,
.utility-bar .filters-inline .filter-field-picker > summary.btn {
  padding: 5px 12px;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 8px;
  box-shadow: none;
}

.utility-bar .filters-inline > .btn:hover,
.utility-bar .filters-inline .filter-field-picker > summary.btn:hover {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.utility-bar .filters-inline > .btn-primary {
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.14);
}

.utility-bar .filters-inline > .btn-primary:hover {
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.utility-bar .filters-inline > .btn-primary:active,
.utility-bar .filters-inline > .btn:active,
.utility-bar .filters-inline .filter-field-picker > summary.btn:active {
  box-shadow: none;
}

.filter-builder-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-builder-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-builder-group {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}

.filter-builder-group .input,
.filter-builder-group .filter-field-pill,
.filter-builder-group .filter-tags-wrap {
  border-radius: 0;
}

.filter-builder-group .filter-field-pill {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}

.filter-remove-pill {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 0 10px;
  min-height: 32px;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: 0;
}

.filter-builder-group .filter-remove-pill:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.filter-builder-group .filter-field-pill:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.filter-builder-group .filter-value-input.is-range-end {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.filter-operator-input {
  padding-right: 28px;
}

/* Tags wrap — sits in the same pill group like a text input */
.filter-tags-wrap {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 160px;
  max-width: 360px;
  border: 1px solid #e2e8f0;
  margin-left: -1px;
  background: #fff;
  padding: 3px 6px;
  min-height: 32px;
  font-size: 13px;
  cursor: text;
  border-radius: 0;
}

.filter-tags-wrap:not([hidden]) {
  display: inline-flex;
}

.filter-tags-wrap .filter-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 6px;
  padding: 1px 6px 1px 8px;
  font-size: 12px;
  white-space: nowrap;
  max-width: 180px;
}

.filter-tags-wrap .filter-tag-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-tags-wrap .filter-tag-chip-remove {
  background: none;
  border: none;
  color: #0369a1;
  font-size: 14px;
  line-height: 1;
  padding: 0 1px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.filter-tags-wrap .filter-tag-chip-remove:hover {
  color: #7c3aed;
}

.filter-tags-wrap .filter-tag-text-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  min-width: 80px;
  padding: 2px 0;
  flex: 1;
}

/* last child border-radius for tags wrap too — handled via is-value-last class */

.filter-field-picker {
  position: relative;
}

.filter-field-picker summary {
  list-style: none;
}

.filter-field-picker summary::-webkit-details-marker {
  display: none;
}

.filter-field-menu {
  position: absolute;
  top: 100%;
  /* left:0: grow right into main content; right:0 drew under the fixed sidebar. */
  left: 0;
  right: auto;
  display: flex;
  flex-direction: column;
  max-width: min(900px, calc(100vw - 24px));
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px 0;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  z-index: 30;
}
.filter-field-search-wrap {
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
}
.filter-field-search {
  width: 100%;
  min-width: 220px;
  font-size: 13px;
}
.filter-field-browse {
  display: flex;
}
.filter-field-browse[hidden] {
  display: none;
}
.filter-field-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 0;
}
.filter-field-results[hidden] {
  display: none;
}
.filter-field-results .filter-field-option {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--ink, #0f172a);
}
.filter-field-results .filter-field-option:hover,
.filter-field-results .filter-field-option.is-highlighted {
  background: #f1f5f9;
}
.filter-field-no-results {
  padding: 12px 16px;
  text-align: center;
}
.filter-field-no-results p {
  margin: 0;
}

.filter-field-column {
  min-width: 200px;
}

.filter-field-menu > .filter-field-column + .filter-field-column {
  border-left: 1px solid #e2e8f0;
}

.filter-field-option {
  width: 100%;
  display: block;
  text-align: left;
  background: #ffffff;
  border: none;
  padding: 8px 10px;
  font-size: 14px;
}

.filter-field-menu .view-menu-item {
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 0;
  width: 100%;
}

.filter-field-menu .view-menu-item-parent {
  display: block;
  position: relative;
  padding-right: 24px;
}

.filter-field-menu .view-menu-item-parent .view-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.filter-field-option:hover {
  background: #f1f5f9;
}

.view-menu-item-parent {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-menu-item-parent .view-submenu {
  position: absolute;
  top: 0;
  left: 100%;
  min-width: 260px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 30;
}

.filter-field-menu .view-submenu {
  padding: 4px 0;
  display: none;
  flex-direction: row;
  /* Right: left-opening panels sit under the fixed sidebar (main stacks below it). */
  left: 100%;
  right: auto;
  margin-left: 2px;
  margin-right: 0;
  z-index: 35;
}

.filter-field-menu .view-submenu > .filter-field-column + .filter-field-column {
  border-left: 1px solid #e2e8f0;
}

.view-submenu .view-menu-item {
  width: 100%;
  display: block;
  padding: 8px 10px;
}

.view-menu-item-parent:hover .view-submenu {
  display: block;
}

.view-menu-item-parent:focus-within .view-submenu {
  display: block;
}

.filter-field-menu .view-menu-item-parent:hover > .view-submenu {
  display: flex;
}

.filter-field-menu .view-menu-item-parent:focus-within > .view-submenu {
  display: flex;
}

.utility-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.utility-actions[hidden] {
  display: none;
}

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

.bulk-actions-panel,
.bulk-actions-form {
  display: block;
}

.bulk-action-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.select-cell {
  text-align: center;
  width: 36px;
}

.data-table th[data-column-id="select"],
.data-table td[data-column-id="select"] {
  width: 36px;
  padding-left: 12px;
  padding-right: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.utility-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.filters-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--soft);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  max-width: 520px;
  color: var(--muted);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.search:focus-within {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.search-compact {
  max-width: 620px;
  padding: 8px 12px;
  flex: 1;
}

.search input {
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  font-size: inherit;
  color: var(--ink);
}

.search input::placeholder {
  color: var(--muted);
}

.search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
}
.search-icon-svg {
  flex-shrink: 0;
  color: var(--muted, #64748b);
}

.mobile-search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
  flex-shrink: 0;
}

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

.topbar-actions .btn-compact,
.topbar-actions .input-compact,
.topbar-actions .favorite-toggle,
.topbar-actions .action-menu-trigger {
  height: 32px;
}

.topbar-actions .btn-compact {
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
}

.topbar-actions .input-compact {
  padding: 0 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  box-sizing: border-box;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.page-header-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-header-media {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: #f1f5f9;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.page-header-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-header-placeholder {
  font-weight: 600;
  color: #334155;
}

.page-header h1 {
  margin: 6px 0 4px;
  font-size: 24px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.muted-subtext {
  font-size: 12px;
  margin-top: 2px;
}

/* Forecasting variant column: truncated title + SKU on next line */
.variant-cell {
  max-width: 200px;
}
.variant-cell .variant-cell-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-cell .variant-cell-sku {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

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

.per-page-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.per-page-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.btn:active {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: none;
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.18);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.25);
}

.btn-danger:active {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: none;
}

.btn-success {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.18);
}
.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
  box-shadow: 0 2px 4px rgba(22, 163, 74, 0.25);
}
.btn-success:active {
  background: #166534;
  border-color: #166534;
  box-shadow: none;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.action-menu-trigger-primary.btn {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.action-menu-trigger-primary.btn .view-caret {
  color: #ffffff;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.column-controls .btn-icon-box {
  background: transparent;
  width: 10px;
  height: 18px;
}

.column-controls-icon {
  width: 14px;
  height: 14px;
  stroke: #334155;
  stroke-width: 1.6;
  fill: none;
}

.btn-compact {
  padding: 6px 10px;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

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

.dashboard-with-feed {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 24px;
  align-items: start;
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.dashboard-activity-feed {
  position: sticky;
  top: 24px;
}

.dashboard-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 70vh;
  overflow-y: auto;
}

.dashboard-activity-item {
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.dashboard-activity-item:last-child {
  border-bottom: none;
}

.dashboard-activity-time {
  display: block;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.dashboard-activity-text {
  margin: 0;
}

.dashboard-activity-user {
  color: var(--muted);
  font-weight: 500;
}

.dashboard-activity-sep {
  color: var(--muted);
}

.vendor-show {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.vendor-show-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.purchase-order-show {
  grid-template-columns: minmax(0, 1fr) 280px;
}

.vendor-sidebar-stack {
  display: grid;
  gap: 16px;
}

.purchase-order-sidebar-stack {
  display: grid;
  gap: 16px;
}

.po-line-items-total {
  padding-left: 20px;
  padding-right: 20px;
}

.card,
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 16px;
}

.dashboard-pilot-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}
.dashboard-pilot-strip__label {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 11px;
}
.dashboard-pilot-strip__policy {
  font-weight: 600;
}
.dashboard-pilot-strip__meta {
  font-size: 13px;
}
.dashboard-pilot-strip__recs {
  margin-left: auto;
}

.dashboard-rec-explained {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--soft);
  border-radius: var(--radius);
  font-size: 13px;
}
.dashboard-rec-explained__label {
  font-weight: 600;
  color: var(--muted);
}
.dashboard-rec-explained__sku {
  font-family: ui-monospace, monospace;
  font-weight: 500;
}
.dashboard-rec-explained__text {
  flex: 1;
  min-width: 0;
}

.card-label {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.card-value {
  margin: 10px 0 4px;
  font-size: 24px;
  font-weight: 600;
}

.card-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

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

.panel-header .muted {
  margin: 2px 0 0;
}

.panel-header-stacked {
  flex-direction: column;
  align-items: stretch;
}
.panel-header-stacked .muted {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.5;
  max-width: 60em;
}
.form-actions-end {
  justify-content: flex-end;
}

/* Compact visibility date card — minimal by default, explanation behind More info */
.visibility-date-card {
  padding: 12px 16px;
}
.visibility-date-card__form {
  margin: 0;
}
.visibility-date-card__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}
.visibility-date-card__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #0f172a);
}
.visibility-date-card .radio-group-inline {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.visibility-date-card .radio-group-inline .radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: normal;
  margin: 0;
}
.visibility-date-card__more {
  margin-left: auto;
}
.visibility-date-card__more-trigger {
  font-size: 12px;
  color: var(--muted, #64748b);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.visibility-date-card__more-trigger::-webkit-details-marker {
  display: none;
}
.visibility-date-card__more-trigger::before {
  content: "▶ ";
  font-size: 10px;
  opacity: 0.7;
}
.visibility-date-card__more[open] .visibility-date-card__more-trigger::before {
  content: "▼ ";
}
.visibility-date-card__more-trigger:hover {
  color: var(--ink, #0f172a);
}
.visibility-date-card__more-content {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #e5e7eb);
  font-size: 13px;
  line-height: 1.5;
  max-width: 52em;
}
.visibility-date-card__more-content p {
  margin: 0;
}

/* Settings overview: grouped list layout */

.settings-overview-panel {
  padding: 0;
  overflow: hidden;
}

.settings-overview-search {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.settings-overview-search__field {
  position: relative;
  display: flex;
  align-items: center;
}

.settings-overview-search__icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted, #9ca3af);
  pointer-events: none;
  flex-shrink: 0;
}

.settings-overview-search__input {
  width: 100%;
  height: 34px;
  padding: 0 32px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg, #f8fafc);
  font-size: 13px;
  color: var(--ink, #0f172a);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  /* suppress browser native search field chrome */
  -webkit-appearance: none;
  appearance: none;
}

.settings-overview-search__input::placeholder {
  color: var(--muted, #9ca3af);
}

.settings-overview-search__input:focus {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fff;
}

/* suppress native clear button in webkit */
.settings-overview-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.settings-overview-search__clear {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted, #9ca3af);
  border-radius: 4px;
}

.settings-overview-search__clear:hover {
  color: var(--ink, #374151);
}

.settings-overview-search__clear svg {
  width: 14px;
  height: 14px;
}

.settings-overview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 28px;
  color: var(--muted, #9ca3af);
  text-align: center;
}

.settings-overview-empty svg {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

.settings-overview-empty p {
  margin: 0;
  font-size: 13px;
}

.settings-overview-section {
  padding: 28px 28px 0;
}

.settings-overview-section--first {
  padding-top: 24px;
}

.settings-overview-section:last-child {
  padding-bottom: 24px;
}

.settings-overview-group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 6px;
}

.settings-list {
  border-top: 1px solid var(--line);
  margin: 0 -28px;
  padding: 0 28px;
}

.settings-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background 0.12s ease;
  margin: 0 -28px;
  padding-left: 28px;
  padding-right: 28px;
}

.settings-list-item:hover {
  background: var(--bg-hover, #f8fafc);
}

.settings-list-item:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: -2px;
}

.settings-list-item__icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--soft, #f1f5f9);
  display: grid;
  place-items: center;
  color: #374151;
}

.settings-list-item__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-list-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.settings-list-item__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-list-item__desc {
  font-size: 12px;
  color: var(--muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-list-item__chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--muted, #9ca3af);
}

/* Settings two-column layout: left nav + right content */
.settings-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  max-width: 1400px;
}

.settings-nav {
  flex-shrink: 0;
  width: 220px;
  position: sticky;
  top: 24px;
  padding: 16px 0;
  border-right: 1px solid var(--line, #e2e8f0);
}

.settings-nav__group {
  margin-bottom: 20px;
}

.settings-nav__group:last-child {
  margin-bottom: 0;
}

.settings-nav__group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  margin: 0 0 8px 0;
  padding: 0 12px 0 0;
}

.settings-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.settings-nav__link {
  display: block;
  padding: 8px 12px 8px 0;
  font-size: 14px;
  color: var(--text, #0f172a);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings-nav__link:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text, #0f172a);
}

.settings-nav__link--active {
  font-weight: 600;
  color: var(--accent, #2563eb);
}

.settings-content {
  flex: 1;
  min-width: 0;
}
.settings-content > .panel + .panel {
  margin-top: 24px;
}

.population-method-grid {
  align-items: stretch;
}

.population-method-card {
  cursor: pointer;
  position: relative;
}

.population-method-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.population-method-card.is-selected,
.population-method-card:has(.population-method-input:checked) {
  border-color: #c7d2fe;
  background: var(--accent-weak);
}

.population-method-options {
  margin-top: 16px;
}

.settings-reporting {
  display: grid;
  gap: 12px;
}

.settings-reporting-inner {
  max-width: 1040px;
}

.settings-row {
  display: grid;
  gap: 24px;
  padding: 8px 0;
}

.settings-row-two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
}

.settings-col h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.settings-col p {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
}

.settings-col p:last-child {
  margin-bottom: 0;
}

.settings-col-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-col-inputs .form-field {
  gap: 6px;
}

.settings-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.settings-subsection-title {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.settings-subsection-title:first-child {
  margin-top: 0;
}

.settings-abc-grid {
  align-items: end;
}

.settings-abc-hint {
  margin: 8px 0 0;
  font-size: 12px;
}

.settings-guidance {
  margin-top: 8px;
}

.settings-guidance > summary {
  list-style: none;
}

.settings-guidance > summary::-webkit-details-marker {
  display: none;
}

.settings-guidance-trigger {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.settings-guidance-body {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.panel-header-tight {
  margin-bottom: 8px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

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

.panel-total {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.integration-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integration-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.integration-header h2 {
  margin: 0;
  font-size: 18px;
}

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

.integration-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.integration-section h3 {
  margin: 0;
  font-size: 15px;
}

.integration-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* Settings list panels (integrations / MCP index) — same anatomy as .panel.intg-section on integration show */
.panel.integration-list {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.integration-list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.integration-list-header h2,
.integration-list-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.integration-list-header p.muted {
  margin: 4px 0 0;
  line-height: 1.4;
}

.integration-list-items {
  display: grid;
  gap: 12px;
  padding: 16px 24px 20px;
}

.mcp-scheduled-imports-table .mcp-import-last-run {
  white-space: nowrap;
}
.mcp-scheduled-imports-table .mcp-import-enabled-cell {
  vertical-align: middle;
}
.mcp-scheduled-imports-table .mcp-import-actions-cell {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Transform toggle button ── */
.transform-toggle-btn { color: #94a3b8; transition: color 0.15s; }
.transform-toggle-btn:hover { color: var(--accent, #2563eb); }
.transform-toggle-btn.transform-btn-active { color: var(--accent, #2563eb); }

/* ── Transform badge in show view ── */
.transform-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #6366f1;
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Rules summary on show page ── */
.rules-summary { display: flex; flex-direction: column; gap: 6px; }
.rule-summary-card {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.rule-summary-card code { font-size: 12px; background: #eef2ff; padding: 1px 5px; border-radius: 3px; }
.rule-summary-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.integration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

a.integration-row.integration-row-link {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

a.integration-row.integration-row-link:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

a.integration-row.integration-row-link:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.integration-row-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #94a3b8;
}

a.integration-row.integration-row-link:hover .integration-row-chevron {
  color: #64748b;
}

.integration-row-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.integration-row-meta > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.integration-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.integration-avatar-logo {
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px;
  box-sizing: border-box;
}

.integration-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.integration-name {
  font-weight: 600;
  line-height: 1.25;
}

.integration-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.integration-empty,
.integration-empty-state {
  display: grid;
  gap: 12px;
  margin: 16px 24px 20px;
  padding: 20px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.integration-empty p,
.integration-empty-state p {
  margin: 0;
}


.channel-picker {
  display: grid;
  gap: 16px;
}

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

.channel-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.channel-tile:hover {
  border-color: #cbd5f5;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.channel-tile.is-disabled {
  opacity: 0.6;
  pointer-events: none;
  background: #f8fafc;
}

.channel-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.channel-name {
  font-weight: 600;
}

.channel-soon {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.integration-setup {
  display: grid;
  gap: 16px;
  max-width: 520px;
}

.integration-setup-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.intg-auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin: 4px 0 8px;
}

.intg-auth-tab {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.intg-auth-tab:hover {
  color: var(--text);
}

.intg-auth-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.toggle input {
  accent-color: var(--accent);
}

/* ─── Integration settings page (redesign) ──────────────── */
.intg-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  /* Match .settings-content > .panel + .panel (24px) so stack spacing is even */
  margin-bottom: 24px;
}
.intg-status-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.intg-provider-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  background: #64748b;
}
.intg-provider-icon-shopify { background: #95bf47; }
.intg-provider-icon-printnode { background: #3b82f6; }

.intg-provider-icon-logo {
  background: #fff;
  border: 1px solid var(--line);
  padding: 7px;
  box-sizing: border-box;
}

.intg-provider-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.intg-status-left > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.intg-status-left > div:last-child > p.muted {
  margin: 0;
  line-height: 1.35;
}

.intg-provider-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}
.intg-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}
.intg-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}
.intg-status-connected .intg-status-dot { background: #22c55e; }
.intg-status-connected { color: #15803d; background: #f0fdf4; }
.intg-status-error .intg-status-dot { background: #ef4444; }
.intg-status-error { color: #b91c1c; background: #fef2f2; }
.intg-status-pending .intg-status-dot { background: #f59e0b; }
.intg-status-pending { color: #92400e; background: #fffbeb; }

.intg-section {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* Clip inner backgrounds to panel radius; omit table-heavy panels that use sticky thead */
.intg-section.intg-sync-history,
.intg-section.intg-metafield-imports {
  overflow: hidden;
}
.intg-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.intg-section-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.intg-section-header p.muted {
  margin: 4px 0 0;
  line-height: 1.4;
}
.intg-section-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.intg-danger-zone .intg-section-footer {
  background: #fef2f2;
}

.intg-danger-zone {
  border-color: #fecaca;
}

.intg-danger-zone .intg-section-header h3 {
  color: var(--danger);
}

/* Header + footer only (no body): avoid double rule between them */
.intg-section > .intg-section-header + .intg-section-footer {
  border-top: none;
}

.intg-sync-form {
  display: flex;
  flex-direction: column;
}
.intg-sync-items {
  display: flex;
  flex-direction: column;
}
.intg-sync-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s ease;
}
.intg-sync-items > .intg-sync-toggle:first-child {
  border-top: none;
}
.intg-app-ext-block:first-child .intg-sync-toggle {
  border-top: none;
}
.intg-sync-toggle:hover {
  background: #f8fafc;
}
.intg-sync-label {
  display: block;
  font-weight: 500;
  font-size: 14px;
}
.intg-sync-desc {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 1px;
}

/* Toggle switch */
.intg-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.intg-switch-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.intg-switch-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
  cursor: pointer;
}
.intg-switch-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.intg-switch-input:checked + .intg-switch-slider {
  background: var(--accent);
}
.intg-switch-input:checked + .intg-switch-slider::before {
  transform: translateX(18px);
}
.intg-switch-input:focus-visible + .intg-switch-slider {
  box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}

.intg-backfill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px 20px;
}
.intg-backfill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  color: inherit;
}
.intg-backfill-btn:hover {
  border-color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(99,102,241,0.08);
}
.intg-backfill-icon {
  font-size: 16px;
  line-height: 1;
}

/* App extension blocks */
.intg-app-ext-block {
  border-top: 1px solid var(--line);
}
.intg-app-ext-block:first-child {
  border-top: none;
}
.intg-app-ext-settings {
  padding: 12px 24px 16px 72px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-subtle, #f9fafb);
  border-top: 1px solid var(--line);
}
.intg-app-ext-setting-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.intg-app-ext-setting-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.intg-app-ext-setting-label .intg-app-ext-setting-text {
  min-width: 180px;
  color: var(--fg);
}
.intg-app-ext-checkbox {
  padding: 0;
  border: none;
}
.intg-switch.intg-switch-sm {
  width: 36px;
  height: 20px;
}
.intg-switch-sm .intg-switch-slider::before {
  width: 14px;
  height: 14px;
}
.intg-switch-sm .intg-switch-input:checked + .intg-switch-slider::before {
  transform: translateX(16px);
}

.intg-reconnect-form {
  padding: 16px 24px 20px;
}
.intg-reconnect-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.intg-detail-grid {
  display: flex;
  gap: 32px;
  padding: 16px 24px 20px;
}
.intg-detail-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.intg-detail-grid dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.intg-detail-grid dd {
  margin: 0;
  font-weight: 500;
}

.intg-vendor-tags {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}
.intg-vendor-tags h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}
.intg-vendor-tags-inputs {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}
.intg-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}
.intg-radio-label input {
  accent-color: var(--accent);
}

.intg-empty-hint {
  padding: 12px 24px;
}

.intg-section-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.intg-manual-metafield-error {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--danger, #d32f2f);
}

/* Sync history: filterable, paginated (no full page reload) */
.intg-sync-history-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 12px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.intg-sync-history .table-wrap {
  border: none;
  border-radius: 0;
}

.intg-sync-history .data-table tbody tr:last-child td {
  border-bottom: none;
}

.intg-sync-history-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.intg-sync-history-filter .input {
  min-width: 140px;
}

.intg-sync-history .intg-sync-history-pagination {
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

/* Metafield imports card: no inner table border */
.intg-metafield-imports [data-metafield-imports-target="emptyState"]:not(.hidden) {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.intg-metafield-imports .intg-metafield-table-wrap {
  border: none;
  border-radius: 0;
}

.intg-metafield-imports .data-table tbody tr:last-child td {
  border-bottom: none;
}

.intg-section.intg-printnode-printers .table-wrap {
  border: none;
  border-radius: 0;
}

.intg-select-compact {
  max-width: 260px;
}

.intg-input-compact {
  max-width: 200px;
}

/* Metafield imports: compact table so empty state doesn't have excess vertical space */
.intg-metafield-table-wrap {
  min-height: 0;
}
.intg-metafield-table-wrap .data-table tbody tr:only-child td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.intg-defaults-grid {
  display: flex;
  flex-direction: column;
  padding: 0 24px;
}
.intg-default-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.intg-defaults-grid > .intg-default-row:first-child {
  border-top: none;
}
.intg-default-row strong {
  font-size: 14px;
}

.table-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

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

.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.tab.is-active {
  background: var(--accent-weak);
  border-color: #c7d2fe;
  color: #1d4ed8;
  font-weight: 600;
}

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

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

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

.chip {
  background: var(--soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: #334155;
}

.input {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  min-width: 180px;
}

.input-compact {
  min-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
}

.column-controls {
  position: relative;
}

.column-selector {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.column-selector-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}

.column-selector-search {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

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

.column-selector-group {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.column-selector-group-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.column-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.checkbox-row-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-controls > summary {
  list-style: none;
}

.column-controls > summary::-webkit-details-marker {
  display: none;
}

.column-panel {
  position: absolute;
  top: 38px;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: 380px;
  max-height: 520px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 20;
  overflow: hidden;
}

.column-controls.is-open .column-panel,
.column-controls[open] .column-panel {
  display: flex;
  flex-direction: column;
}

/* ── Search ── */
.column-panel-search {
  padding: 6px 12px 0;
  flex-shrink: 0;
}

.column-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.column-search-input {
  width: 100%;
  font-size: 13px;
  padding-right: 28px;
}

.column-search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #94a3b8;
  transition: color 0.15s, background 0.15s;
}

.column-search-clear:hover {
  color: #334155;
  background: #f1f5f9;
}

/* ── Section title ── */
.column-panel-section-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Presets ── */
.column-panel-presets {
  padding: 8px 12px 0;
  display: grid;
  gap: 6px;
  flex-shrink: 0;
}

.column-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.column-preset-chip {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #334155;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.column-preset-chip:hover {
  background: #f1f5f9;
  border-color: #c7d2fe;
}

.column-preset-chip.is-active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}

/* ── AI Suggest ── */
.column-panel-ai {
  padding: 10px 12px 0;
  flex-shrink: 0;
}

.column-ai-input-wrap {
  display: flex;
  gap: 4px;
  align-items: center;
}

.column-ai-input {
  flex: 1;
  font-size: 13px;
}

.column-ai-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #ffffff;
  cursor: pointer;
  transition: opacity 0.15s;
}

.column-ai-btn:hover {
  opacity: 0.85;
}

.column-ai-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.column-ai-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: #6366f1;
  font-style: italic;
}

/* ── Column list ── */
.column-panel-list {
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.column-panel-hint {
  margin: 0;
  padding: 6px 12px 10px;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Column option row ── */
.column-option {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: #334155;
  padding: 4px 12px;
  transition: background 0.1s;
  position: relative;
}

.column-option:hover {
  background: #f8fafc;
}

.column-option-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.column-option-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.column-option-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-option-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ede9fe;
  color: #6d28d9;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Pin button ── */
.column-pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #cbd5e1;
  transition: color 0.15s, background 0.15s;
}

.column-pin-btn:hover {
  color: #6366f1;
  background: #f1f5f9;
}

.column-pin-btn.is-active {
  color: #4f46e5;
}

.column-pin-btn.is-active .pin-icon {
  filter: drop-shadow(0 0 1px rgba(79, 70, 229, 0.4));
}

.column-pin-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.column-pin-btn.is-locked {
  color: #4f46e5;
  opacity: 0.6;
  cursor: default;
}

.column-pin-btn.is-locked:hover {
  background: transparent;
}

/* ── Drag handle ── */
.drag-handle {
  color: var(--muted);
  font-size: 14px;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}

/* ── Drag-and-drop indicators — panel rows ── */
.column-option.is-dragging {
  opacity: 0.4;
}

.column-option.column-drag-above {
  box-shadow: inset 0 2px 0 0 #6366f1;
}

.column-option.column-drag-below {
  box-shadow: inset 0 -2px 0 0 #6366f1;
}

/* ── Drag-and-drop indicators — table headers ── */
.data-table th.column-drag-over-left {
  box-shadow: inset 3px 0 0 0 #6366f1;
}

.data-table th.column-drag-over-right {
  box-shadow: inset -3px 0 0 0 #6366f1;
}

/* ── Drop indicator line (absolute positioned) ── */
.column-drop-indicator {
  height: 2px;
  background: #6366f1;
  border-radius: 1px;
  margin: 0 12px;
  pointer-events: none;
}

.product-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #334155;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.data-table th.is-dragging {
  opacity: 0.6;
}

.input:focus {
  outline: 2px solid #c7d2fe;
  border-color: #c7d2fe;
}

.link {
  color: var(--accent);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Order form: line items panel; table scrolls inside. No overflow on panel so variant dropdown is not clipped. */
.order-form-line-items {
  min-width: 0;
}
.order-form-line-items .table-wrap {
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Searchable variant dropdown in order form */
.variant-select-cell {
  position: relative;
  min-width: 200px;
}
.variant-select-cell input[data-variant-select-target="search"] {
  width: 100%;
  min-width: 180px;
}
.variant-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
}
/* When inside a scroll container (e.g. order form table), position fixed so dropdown is not clipped */
.variant-dropdown--fixed {
  position: fixed !important;
  left: 0;
  right: auto;
  top: 0;
  margin-top: 0;
  z-index: 1000;
}
.variant-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  border: none;
  background: none;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.variant-dropdown-item:hover {
  background: var(--hover-bg, #f1f5f9);
}
.variant-dropdown-item.muted {
  color: var(--muted);
  cursor: default;
}

.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
}

.table-panel .pagination:last-child {
  margin-bottom: 0;
}

.table-panel .table-wrap {
  border: none;
  border-radius: 0;
}
.table-panel .data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Line items table: keep outer card rounded; remove inner border so no double border */
.panel-line-items .table-panel {
  border: none;
  border-radius: 0;
}
.panel-line-items .table-panel .table-wrap {
  border-radius: 0;
}

.table-panel .panel-header,
.table-panel .panel-header-tight {
  padding: 16px 16px 0;
}

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

/* Compact, consistent padding when pagination is inside a panel */
.table-panel .pagination,
.panel .pagination {
  padding: 10px 16px;
  margin: 0;
}

.pagination .muted {
  font-size: 13px;
}

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

.pagination-page {
  font-size: 13px;
  color: var(--muted);
}

.btn.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.toolbar .topbar-actions .btn:not(.btn-primary):hover,
.toolbar .topbar-actions .column-controls > summary:hover,
.toolbar .filter-field-picker > summary:hover,
.toolbar .filters-inline .btn:not(.btn-primary):hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.btn-primary:active {
  background: #1e40af;
  border-color: #1e40af;
  box-shadow: none;
}

/* ── Purchase orders index — chevron pipeline ────────────────────── */
.po-pipeline {
  --pip-h: 70px;
  --pip-arrow: 10px;
  --pip-bg: #f8fafc;
  --pip-bg-hover: #f1f5f9;
  --pip-bg-active: #eff6ff;
  --pip-bg-empty: #f8fafc;
  --pip-border: var(--line, #e2e8f0);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
}

.po-pipeline__steps {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.po-pipeline__step {
  position: relative;
  flex: 1 1 0%;
  min-width: 0;
}

.po-pipeline__step::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: var(--pip-arrow);
  height: var(--pip-arrow);
  background: var(--pip-bg);
  border-right: 1px solid var(--pip-border);
  border-bottom: 1px solid var(--pip-border);
  transform: translate(50%, -50%) rotate(-45deg);
  z-index: 3;
  pointer-events: none;
}

.po-pipeline__step--last::after {
  display: none;
}

.po-pipeline__step-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-decoration: none;
  color: inherit;
  padding: 7px 6px 8px;
  padding-left: calc(6px + var(--pip-arrow) / 2);
  background: var(--pip-bg);
  height: var(--pip-h);
  box-sizing: border-box;
  transition: background 0.12s ease;
  border-top: 1px solid var(--pip-border);
  border-bottom: 1px solid var(--pip-border);
}

.po-pipeline__step--first .po-pipeline__step-link {
  padding-left: 10px;
  border-left: 1px solid var(--pip-border);
  border-radius: 8px 0 0 8px;
}

.po-pipeline__step--last .po-pipeline__step-link {
  padding-right: 10px;
  border-right: 1px solid var(--pip-border);
  border-radius: 0 8px 8px 0;
}

.po-pipeline__step-link:hover {
  background: var(--pip-bg-hover);
}

.po-pipeline__step:hover::after {
  background: var(--pip-bg-hover);
}

.po-pipeline__step-link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  z-index: 4;
}

.po-pipeline__step--active .po-pipeline__step-link {
  background: var(--pip-bg-active);
}

.po-pipeline__step--active::after {
  background: var(--pip-bg-active);
}

.po-pipeline__step--empty .po-pipeline__step-link {
  background: var(--pip-bg-empty);
}

.po-pipeline__step--empty::after {
  background: var(--pip-bg-empty);
}

.po-pipeline__step--empty .po-pipeline__step-count {
  color: #cbd5e1;
}

.po-pipeline__step--empty .po-pipeline__step-label {
  color: #94a3b8;
}

.po-pipeline__step--empty .po-pipeline__step-value {
  visibility: hidden;
}

.po-pipeline__step-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #64748b;
  white-space: nowrap;
  line-height: 1.1;
  margin-bottom: 2px;
}

.po-pipeline__step--active .po-pipeline__step-label {
  color: #3b82f6;
}

.po-pipeline__step-count {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1e293b;
  line-height: 1.2;
}

.po-pipeline__step-value {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  line-height: 1.2;
  white-space: nowrap;
  margin-top: 1px;
}

/* ── Mobile: 2×4 grid cards ───── */
@media (max-width: 899px) {
  .po-pipeline {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 14px;
  }

  .po-pipeline__steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--pip-border);
    border-radius: 8px;
    overflow: hidden;
  }

  .po-pipeline__step::after {
    display: none;
  }

  .po-pipeline__step-link {
    --pip-h: 46px;
    padding: 6px 4px;
    border: none;
    border-radius: 0;
    border-right: 1px solid var(--pip-border);
    border-bottom: 1px solid var(--pip-border);
  }

  .po-pipeline__step:nth-child(4n) .po-pipeline__step-link {
    border-right: none;
  }

  .po-pipeline__step:nth-child(n+5) .po-pipeline__step-link {
    border-bottom: none;
  }

  .po-pipeline__step--first .po-pipeline__step-link,
  .po-pipeline__step--last .po-pipeline__step-link {
    padding: 6px 4px;
    border-radius: 0;
    border-left: none;
  }

  .po-pipeline__step-label {
    font-size: 9.5px;
  }

  .po-pipeline__step-count {
    font-size: 13px;
  }

  .po-pipeline__step-value {
    font-size: 9px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .po-pipeline__step-link {
    transition: none;
  }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.data-table th.is-pinned,
.data-table td.is-pinned {
  position: sticky;
  background: #ffffff;
  z-index: 3;
}


.data-table th.is-pinned {
  background: #f8fafc;
  z-index: 4;
}


.data-table .is-pinned-edge {
  border-right: 1px solid #e5e7eb;
  position: relative;
  z-index: 6;
}

.data-table .is-pinned-edge::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: #e5e7eb;
  pointer-events: none;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

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

.data-table th .table-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.data-table th .table-sort:hover {
  color: #334155;
}

.data-table th .table-sort-indicator {
  font-size: 11px;
  opacity: 0.5;
}

.data-table th .table-sort.is-active .table-sort-indicator {
  opacity: 1;
}

.row-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}
.row-actions > *,
.row-actions > form {
  display: inline-flex;
}
.row-actions-inline {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}
.row-actions-inline-form {
  display: inline;
}

.inline-cell {
  min-width: 120px;
  padding: 6px 8px;
  border-radius: 8px;
  outline: none;
}

.inline-cell:focus {
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #c7d2fe;
}

.inline-select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 12px;
  color: #334155;
}

.pill-success {
  background: #dcfce7;
  color: #166534;
}

.pill-warning {
  background: #fef3c7;
  color: #92400e;
}

.pill-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Replenishment rec modal — policy rules scope */
.rec-policy-scope-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pill.pill-scope {
  font-weight: 600;
  border: 1px solid transparent;
}

.pill.pill-scope--default {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.pill.pill-scope--global {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.pill.pill-scope--vendor {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.pill.pill-scope--collection,
.pill.pill-scope--tag,
.pill.pill-scope--abc_class {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.pill.pill-scope--product {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

.pill.pill-scope--variant {
  background: #fce7f3;
  color: #9d174d;
  border-color: #f9a8d4;
}

.pill.pill-scope-detail {
  font-weight: 500;
  background: #ffffff;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.chart-placeholder {
  display: grid;
  gap: 10px;
  padding: 12px 0;
}

.chart-bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.list-title {
  margin: 0 0 4px;
  font-weight: 600;
}

.form-card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-field-wide {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  gap: 12px;
}

/* Stockout dates filter: align buttons with last row of inputs */
.stockout-days-filter-form {
  align-items: end;
}
.stockout-days-filter-form .form-actions {
  align-items: center;
}

.form-field-compact {
  gap: 4px;
}

.reports-topbar-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.reports-topbar-form .form-label {
  font-size: 11px;
  color: var(--muted);
}

.reports-topbar-form .input {
  min-width: 150px;
}

.reports-topbar-form .input-compact {
  min-width: 130px;
}

.reports-page {
  display: grid;
  gap: 16px;
}

.report-builder {
  display: grid;
  gap: 16px;
}

.report-output {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.report-chart {
  min-height: 260px;
}

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

/* ── Report builder: two-column layout ── */
.report-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .report-layout {
    grid-template-columns: 1fr;
  }
  .report-sidebar {
    order: -1;
  }
}

.report-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.report-chart-wrap {
  min-height: 300px;
  padding: 16px;
  position: relative;
}

.report-chart-wrap canvas {
  max-height: 400px;
}

.report-empty-state {
  padding: 48px 16px;
  text-align: center;
}

/* ── Summary metric cards ── */
.report-summary-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.report-summary-card {
  flex: 1 1 140px;
  min-width: 120px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.report-summary-card-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.report-summary-card-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

/* ── Save bar ── */
.report-save-form {
  margin-top: 0;
}

.report-save-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.report-save-bar .input {
  flex: 1;
}

/* ── Right sidebar ── */
.report-sidebar {
  display: grid;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 64px;
  overflow: visible;
}

.rb-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.rb-section:last-child {
  border-bottom: none;
}

.rb-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rb-section-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.rb-section-add {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.rb-section-add:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Selected items list ── */
.rb-selected-list {
  display: grid;
  gap: 4px;
}

.rb-selected-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--soft);
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink);
}

.rb-selected-item-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px;
  line-height: 1;
}

.rb-selected-item-remove:hover {
  color: var(--danger);
}

/* ── Picker popover ── */
.rb-picker-popover {
  display: none;
  position: absolute;
  right: 0;
  top: 0;
  width: 300px;
  max-height: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
  z-index: 100;
  overflow: hidden;
}

.rb-picker-popover.is-open {
  display: flex;
  flex-direction: column;
}

.rb-picker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.rb-picker-search {
  flex: 1;
}

.rb-picker-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.rb-picker-close:hover {
  color: var(--ink);
}

.rb-picker-body {
  overflow-y: auto;
  max-height: 340px;
  padding: 8px;
}

.rb-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  transition: background 0.1s;
}

.rb-picker-item:hover {
  background: var(--soft);
}

.rb-picker-item.is-selected {
  background: var(--accent-weak);
}

.rb-picker-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ── Visualization selector ── */
.rb-viz-current {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.rb-viz-select {
  width: 100%;
}

/* ── Filters ── */
.rb-filters-active {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rb-filter-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.rb-filter-row:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.rb-filter-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.rb-filter-label {
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}

.rb-filter-operator {
  flex: 1;
  min-width: 0;
  max-width: 120px;
}

.rb-filter-row-body {
  min-width: 0;
}

.rb-filter-row-body .rb-filter-input {
  width: 100%;
  box-sizing: border-box;
}

.rb-filter-input {
  flex: 1;
  min-width: 0;
}

.rb-filter-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rb-filter-remove svg {
  width: 14px;
  height: 14px;
}

.rb-filter-remove:hover {
  color: var(--danger);
}

/* ── Topbar layout for report builder ── */
.rb-topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.rb-topbar-dates {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.rb-topbar-dates .input-compact {
  min-width: 120px;
}

.rb-topbar-dates .form-field-compact {
  margin-bottom: 0;
}

.rb-topbar-dates .form-label {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 2px;
}

.topbar-button-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Report index: category grid ── */
.report-index-section {
  margin-bottom: 24px;
}

.report-index-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.report-index-section-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.report-index-section-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.report-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.report-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.report-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.report-card-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.report-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.report-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.report-card-cta {
  border: 2px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

.report-card-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.report-card-cta:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}

/* ── Report category filter pills ── */
.report-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.report-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.report-pill:hover {
  border-color: var(--pill-color, var(--accent));
  color: var(--pill-color, var(--accent));
}

.report-pill.is-active {
  background: var(--pill-color, var(--accent));
  border-color: var(--pill-color, var(--accent));
  color: #fff;
}

/* ── Scheduled reports mini-table ── */
.scheduled-mini-table {
  width: 100%;
  font-size: 13px;
}

.scheduled-mini-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.scheduled-mini-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

/* ── Scheduled reports full page ── */
.schedule-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.schedule-status-badge.enabled {
  background: #d1fae5;
  color: #065f46;
}

.schedule-status-badge.paused {
  background: #fef3c7;
  color: #92400e;
}

/* ── Dropdown (for export) ── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle::after {
  content: " \25BE";
  font-size: 10px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  min-width: 160px;
  z-index: 50;
  padding: 4px;
}

.dropdown-menu.is-open {
  display: block;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}

.dropdown-item:hover {
  background: var(--soft);
}

.dropdown-item-form {
  margin: 0;
  display: block;
}

.dropdown-item-form .dropdown-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.view-menu-item-form {
  margin: 0;
  display: block;
  width: 100%;
}

.view-menu-item-form .view-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink, #0f172a);
  font-size: 13px;
  line-height: 1.4;
  font-family: inherit;
  background: transparent;
  border: none;
  text-decoration: none;
  transition: background 0.1s ease;
  -webkit-appearance: none;
  appearance: none;
}

.view-menu-item-form .view-menu-item:hover {
  background: var(--soft, #f1f5f9);
}

.dropdown-item--danger {
  color: var(--danger);
}

.dropdown-item--danger:hover {
  background: #fef2f2;
}

.dropdown-divider {
  height: 1px;
  background: var(--border, #e2e8f0);
  margin: 4px 0;
}

.page-header-actions-dropdown .dropdown-menu .wf-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  margin: 0;
}

.page-header-actions-dropdown .dropdown-menu .wf-btn:hover {
  background: var(--soft);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.policy-rule-form-hint {
  margin: 0 0 8px;
  font-size: 13px;
}
.policy-rule-advanced {
  margin-top: 8px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 10px);
  overflow: hidden;
}
.policy-rule-advanced-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #0f172a);
  padding: 10px 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface, #f8fafc);
  transition: background 0.15s;
}
.policy-rule-advanced-summary::-webkit-details-marker { display: none; }
.policy-rule-advanced-summary:hover {
  background: var(--line, #e2e8f0);
}
.policy-rule-advanced-chevron {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted, #64748b);
  transition: transform 0.2s;
}
.policy-rule-advanced[open] .policy-rule-advanced-chevron {
  transform: rotate(-180deg);
}
.policy-rule-advanced-hint {
  margin-left: 2px;
  font-weight: normal;
  font-size: 12px;
}
.policy-rule-advanced .form-card { margin-top: 0; margin: 12px 14px 14px; }
.policy-rule-advanced .form-card:last-of-type { margin-bottom: 14px; }

.flash {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 14px;
}

.flash-notice {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #1e3a8a;
}

.flash-alert {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.4);
}

.modal-content {
  position: relative;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  padding: 20px;
  width: min(640px, 90vw);
}

.modal-content-wide, .modal-md {
  width: min(640px, 90vw);
}

dialog.landed-cost-modal {
  max-height: 92vh;
  overflow: hidden;
}
.landed-cost-modal .modal-body {
  max-height: min(60vh, 420px);
  overflow-y: auto;
}

/* ── Add vendor variant modal (two-step wizard) ── */
dialog.modal:has(.add-vendor-variant-modal) {
  max-height: 90vh;
  overflow: visible;
}

.add-vendor-variant-modal {
  width: min(720px, 94vw);
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: min(80vh, 640px);
  overflow: hidden;
}

.add-vendor-variant-modal .modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.add-vendor-variant-modal .modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.add-vendor-variant-modal .modal-header .muted {
  margin: 2px 0 0;
  font-size: 13px;
}

.add-vendor-variant-modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Steps */
.avv-step {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.avv-step-hidden {
  display: none !important;
}

/* Step 1: search box */
.avv-search-box {
  position: relative;
  padding: 16px 24px 12px;
  flex-shrink: 0;
}

.avv-search-icon {
  position: absolute;
  left: 38px;
  top: 28px;
  color: var(--muted);
  pointer-events: none;
}

.avv-search-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.avv-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.avv-search-input::placeholder {
  color: var(--muted);
}

/* Step 1: results */
.avv-results-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px;
  min-height: 0;
}

.avv-results-wrap .data-table {
  margin: 0;
}

.avv-results-wrap .data-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.avv-th-check {
  width: 32px;
}

.avv-empty-state {
  padding: 32px 16px !important;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Step footer (shared by both steps) */
.avv-step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  gap: 12px;
  background: var(--panel);
}

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

.avv-selection-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* Step 2: selected summary */
.avv-selected-summary {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.avv-summary-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--bg-dim, #f1f5f9);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.avv-summary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-dim, #f1f5f9);
  border-radius: var(--radius);
  min-width: 0;
}

.avv-summary-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--line);
}

.avv-summary-thumb-placeholder {
  background: var(--line);
}

.avv-summary-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.avv-summary-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avv-summary-sku {
  font-size: 12px;
  color: var(--muted);
}

/* Step 2: details form */
.avv-details-section {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
}

.avv-details-heading {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
}

.avv-details-desc {
  margin: 0 0 16px;
  font-size: 13px;
}

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

.avv-details-grid .form-field:last-child:nth-child(odd) {
  grid-column: span 1;
}

/* Replenishment recommendation detail modal only */
.rec-detail-modal-content {
  width: min(1200px, 95vw);
}

.rec-detail-modal-content .cv-trend {
  padding-top: 0;
}

/* ── Recommendation modal skeleton loader ── */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.skeleton {
  background: var(--color-gray-100, #e5e7eb);
  border-radius: 4px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-text {
  height: 14px;
}

.skeleton-block {
  width: 100%;
}

.rec-modal-skeleton-content {
  max-height: 88vh;
  overflow: hidden;
}

.rec-modal-skeleton-content .modal-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.rec-modal-skeleton-thumbnail {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  flex-shrink: 0;
}

.rec-modal-skeleton-title {
  width: 200px;
  margin-bottom: 8px;
}

.rec-modal-skeleton-sku {
  width: 100px;
}

.rec-modal-skeleton-body {
  padding: 20px 0 0;
}

.rec-modal-skeleton-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.rec-modal-skeleton-stat {
  height: 72px;
  border-radius: 6px;
}

.rec-modal-skeleton-chart {
  height: 180px;
  border-radius: 6px;
  margin-bottom: 24px;
}

.rec-modal-skeleton-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-modal-skeleton-row {
  height: 14px;
}

/* ── Sales history tab: title truncation & outlier rows ── */
.sales-history-table th.col-title,
.sales-history-table td.col-title {
  max-width: 220px;
  min-width: 80px;
}

.sales-title-truncate {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 220px;
}

.sales-row-outlier {
  background: #fffbeb;
}

.sales-outlier-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 11px;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Recalculate button in modal header ── */
.rec-recalculate-btn {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  padding: 5px 12px;
  white-space: nowrap;
  border-radius: 8px;
}
.rec-recalculate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Stale banner ── */
.rec-stale-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  color: #92400e;
  font-size: 13px;
  margin: -4px 0 12px;
  padding: 8px 14px;
}
.rec-stale-recalculate-btn {
  background: none;
  border: 1px solid #d97706;
  border-radius: 4px;
  color: #b45309;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  white-space: nowrap;
}
.rec-stale-recalculate-btn:hover {
  background: #fef3c7;
}

/* ── Recalculate overlay ── */
.rec-recalculate-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}
.rec-recalculate-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.rec-recalculate-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: rec-spin 0.7s linear infinite;
}
@keyframes rec-spin {
  to { transform: rotate(360deg); }
}
.rec-recalculate-status {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* ── Navigation loading state (prev/next between recommendations) ── */
.rec-nav-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* ── Recommended qty change highlight ── */
@keyframes rec-qty-flash {
  0%   { background: #d1fae5; color: #065f46; }
  80%  { background: #d1fae5; color: #065f46; }
  100% { background: transparent; color: inherit; }
}
.rec-recommended-qty-value.rec-qty-changed {
  animation: rec-qty-flash 4s ease forwards;
  border-radius: 4px;
  padding: 0 4px;
}

/* ── Override quantity UI ── */
.rec-override-badge {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  text-transform: uppercase;
  white-space: nowrap;
}
.rec-override-engine-num {
  font-weight: 600;
}
.rec-override-original-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.rec-override-expiry {
  font-size: 11px;
  margin-top: 3px;
}
.rec-override-edit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 5px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, border-color 0.15s;
}
.cv-card--accent:hover .rec-override-edit-btn,
.cv-card--accent .rec-override-edit-btn:focus {
  opacity: 1;
  border-color: var(--line);
}
.rec-override-edit-btn:hover {
  background: var(--surface);
  color: var(--ink);
}
.cv-card--accent {
  position: relative;
}
.rec-override-form {
  margin-top: 8px;
}
.rec-override-input {
  width: 80px;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 8px;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  text-align: center;
}
.rec-override-input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.rec-override-form-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.rec-override-vendor-rules {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.35;
}
.rec-override-conflict {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}
.rec-override-conflict-msg {
  margin: 0 0 8px;
  font-size: 12px;
  color: #78350f;
  line-height: 1.4;
}
.rec-override-conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.rec-override-conflict-cancel {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px 6px;
}
.rec-override-conflict-cancel:hover {
  color: var(--ink);
}
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover {
  color: var(--accent-dark, #4338ca);
}

/* ── Draft PO action buttons in modal header ── */
.rec-po-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-danger-outline {
  background: none;
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
}
.btn-danger-outline:hover {
  background: #fee2e2;
  border-color: #dc2626;
}
.btn-danger-outline:active {
  background: #fecaca;
}
.hidden {
  display: none !important;
}

/* PO show line items: product cell with info icon, inline qty edit */
.po-line-item-product-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.po-line-item-product-cell > span {
  min-width: 0;
  flex: 1;
}

.po-line-item-product-title {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-line-item-product-cell .info-button {
  flex-shrink: 0;
  margin-top: 2px;
}

.po-line-item-qty-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.po-line-item-qty-input {
  width: 72px;
}

.po-line-item-unit-cost-form {
  display: inline-block;
}

.po-line-item-unit-cost-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.po-line-item-unit-cost-input {
  width: 80px;
}

.po-line-item-save-vv-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.po-line-item-save-vv-btn.is-hidden {
  display: none;
}

.po-line-item-custom-fields-cell {
  background: rgba(0, 0, 0, 0.02);
  vertical-align: top;
}

.po-line-item-cf-details {
  margin: 0;
}

.po-line-item-cf-summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted-color, #6b7280);
  user-select: none;
}

.po-line-item-cf-body {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.po-line-item-manual-review {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.po-line-item-manual-review .pill {
  flex-shrink: 0;
}
.po-line-item-review-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.po-line-item-review-actions .btn {
  margin: 0;
}

.po-line-item--needs-review {
  background: rgba(245, 158, 11, 0.06);
}
.po-line-item-review-badge {
  margin-top: 4px;
}

.inline-edit-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.inline-edit-cell .inline-edit-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.inline-edit-cell:hover .inline-edit-input,
.inline-edit-cell .inline-edit-input:focus {
  border-color: var(--line);
  background: var(--panel);
  outline: none;
  box-shadow: 0 0 0 1px var(--line);
}
.inline-edit-cell .inline-edit-input::placeholder {
  color: var(--muted);
}
.inline-edit-cell .btn-inline-save {
  flex-shrink: 0;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.inline-edit-cell .btn-inline-save:hover {
  background: var(--soft);
}
.inline-edit-cell .btn-inline-save.is-hidden {
  display: none;
}

/* Input group: grey addon (e.g. currency suffix) like Bootstrap */
.input-group {
  display: inline-flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}
.input-group .inline-edit-input,
.input-group input[type="number"] {
  border-radius: 6px 0 0 6px;
  margin-right: -1px;
}
.input-group--price {
  flex: 0 1 auto;
  max-width: 100%;
}
.input-group--price .inline-edit-input,
.input-group--price input[type="number"] {
  width: 5.5ch;
  min-width: 5.5ch;
  max-width: 5.5ch;
  box-sizing: content-box;
}
.input-group-addon {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0 6px 6px 0;
  margin-left: -1px;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.inline-edit-cell:hover .input-group-addon,
.input-group .inline-edit-input:focus + .input-group-addon,
.input-group input:focus + .input-group-addon {
  border-color: var(--line);
  background: var(--soft);
}
.po-line-item-unit-cost-row .input-group:hover .input-group-addon,
.po-line-item-unit-cost-row .input-group input:focus + .input-group-addon {
  border-color: var(--line);
  background: var(--soft);
}

.modal-sm {
  width: min(420px, 90vw);
}

.modal-content-framed {
  padding: 0;
  overflow: hidden;
}

.modal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--line);
}

.modal-titlebar h2,
.modal-titlebar h3 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 16px;
}

.modal-body .muted {
  margin-top: 0;
  margin-bottom: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

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

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rec-nav-arrows {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  padding-right: 10px;
  border-right: 1px solid var(--border);
}

.rec-nav-arrows .icon-button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.rec-nav-arrows .icon-button:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.rec-nav-counter {
  font-size: 12px;
  min-width: 40px;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

/* ── Keyboard shortcuts hints ── */
.rec-kbd-hints-wrapper {
  position: relative;
}
.rec-kbd-hints-toggle {
  color: var(--muted);
  transition: color 0.15s;
}
.rec-kbd-hints-toggle:hover {
  color: var(--ink);
}
.rec-kbd-hints-popover {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  background: var(--panel, #fff);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 10px 14px;
  min-width: 200px;
  white-space: nowrap;
}
.rec-kbd-hints-wrapper:hover .rec-kbd-hints-popover,
.rec-kbd-hints-wrapper:focus-within .rec-kbd-hints-popover {
  display: block;
}
.rec-kbd-hints-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.rec-kbd-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--ink);
}
.rec-kbd-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  background: var(--surface, #f1f5f9);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.rec-kbd-row span {
  color: var(--muted);
}

.modal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.metric-label {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.metric-subtext {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-header-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.modal-header-thumbnail {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--surface);
}

.modal-header-product-name {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-header-sku {
  margin: 0;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

/* ── Vendor-variant modal sections ── */
.vv-modal-section {
  min-width: 0;
}
.vv-modal-section + .vv-modal-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.vv-modal-section-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.vv-modal-section-desc {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.vv-modal-hint {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.input--static {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.modal-close-top {
  position: absolute;
  top: 12px;
  right: 12px;
}

.scale-modal-inner .modal-header {
  margin-bottom: 16px;
}

.scale-preview-table {
  max-height: 280px;
  overflow: auto;
  margin-bottom: 16px;
}

.scale-preview-summary {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--soft);
  border-radius: var(--radius);
  font-size: 14px;
}

.scale-preview-summary p {
  margin: 4px 0;
}

.scale-preview-row-removed {
  opacity: 0.6;
}

.scale-po-modal .modal-content {
  width: min(720px, 92vw);
}

.variant-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: #f1f5f9;
}

.variant-thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.variant-picker-pagination {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.variant-picker-pagination__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.variant-picker-pagination__text {
  font-size: 13px;
  color: var(--muted);
}

.variant-picker-pagination__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-list {
  margin: 0;
  display: grid;
  gap: 12px;
}

.detail-callout {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 13px;
}

.detail-callout .formula-line {
  margin-top: 6px;
  color: #334155;
  font-family: "SF Mono", "SFMono-Regular", ui-monospace, "Cascadia Code", "Fira Mono", "Consolas", "Liberation Mono", "Menlo", monospace;
  font-size: 12px;
}

.metric-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-kpi {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.metric-label {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-value {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.inline-unit {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
  text-transform: none;
  letter-spacing: normal;
}

.modal-section {
  margin-bottom: 20px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.recalc-form {
  display: grid;
  gap: 12px;
}

.recalc-form .form-grid {
  margin-top: 4px;
}

.recalc-form .modal-actions {
  align-items: center;
  justify-content: flex-end;
  align-self: flex-start;
  grid-column: 1 / -1;
}

.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tab-button {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #475569;
}

.tab-button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-weak);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}

.detail-table th {
  text-align: left;
  background: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--muted);
}

.detail-table .detail-group td {
  background: #f8fafc;
  font-weight: 600;
  color: #0f172a;
  border-bottom: 1px solid var(--line);
}

.detail-table .detail-highlight td {
  background: #eef2ff;
  font-weight: 600;
}

/* ═══ Calculation tab (cv-*) ═══ */
.cv {
  max-width: 100%;
  padding: 0 0 8px;
}

/* Metric cards row */
.cv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.cv-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.cv-card--accent {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.cv-card-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cv-card--accent .cv-card-label {
  color: #4338ca;
}
.cv-card-value {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.cv-card--accent .cv-card-value {
  color: var(--accent);
  font-size: 26px;
  font-weight: 800;
}
.cv-card-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.cv-card-purchase-conversion {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.cv-card-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}
.cv-card-badge--danger {
  background: #fee2e2;
  color: #991b1b;
}
.cv-card-badge--warn {
  background: #fef3c7;
  color: #92400e;
}

/* Formula strip */
.cv-formula {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 14px;
  margin-bottom: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  flex-wrap: wrap;
}
.cv-formula-term {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.cv-formula-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cv-formula-lbl {
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cv-formula-op {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  padding: 0 1px;
}
.cv-formula-eq {
  font-size: 16px;
  font-weight: 300;
  color: var(--muted);
  padding: 0 3px;
}
.cv-formula-term--result .cv-formula-num {
  font-size: 18px;
  color: var(--accent);
}

/* Metric rows */
.cv-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}

.cv-row {
  border-bottom: 1px solid var(--line);
}
.cv-row:last-child {
  border-bottom: none;
}
.cv-row-head {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  transition: background 0.15s;
}
.cv-row-head:hover {
  background: #f8fafc;
}
.cv-row-head::-webkit-details-marker {
  display: none;
}
.cv-row-head--flat {
  cursor: default;
}
.cv-row-head--flat:hover {
  background: transparent;
}

.cv-row-chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.cv-row-chevron::before {
  content: "›";
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}
.cv-row[open] > summary .cv-row-chevron,
.cv-assumptions[open] > summary .cv-row-chevron {
  transform: rotate(90deg);
  color: var(--ink);
}

.cv-row--flat .cv-row-head {
  padding-left: 44px;
}

.cv-row-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.cv-row-num {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.cv-row-num small {
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  margin-left: 3px;
}

.cv-row-body {
  padding: 0 16px 14px 44px;
}

/* Detail sub-rows (label : value) */
.cv-detail {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed #eef0f4;
  font-size: 12px;
}
.cv-detail:last-child {
  border-bottom: none;
}
.cv-detail > span:first-child {
  color: var(--muted);
  font-weight: 500;
}
.cv-detail > span:last-child {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
}

/* Assumptions */
.cv-assumptions {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
}
.cv-assumptions-head {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.cv-assumptions-head::-webkit-details-marker {
  display: none;
}
.cv-assumptions-body {
  padding: 4px 16px 14px 44px;
}

/* Safety stock formula mini-strip */
.cv-ss-formula {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f0f4f8;
  border-radius: 8px;
  flex-wrap: wrap;
}
.cv-ss-term {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.cv-ss-term small {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}
.cv-ss-op {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
}
.cv-ss-term--result {
  font-size: 17px;
  color: var(--accent);
}

/* Detail row variants */
.cv-detail-divider {
  border-top: 1px dashed #dde1e8;
  margin: 8px 0;
}
.cv-detail--label > span:first-child {
  color: var(--ink);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cv-detail--indent {
  padding-left: 12px;
}
.cv-detail--total > span:last-child {
  font-weight: 700;
}

/* Inline callout in cv-row-body */
.cv-callout {
  margin: 8px 0 2px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.cv-callout--warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Forecast confidence card */
.cv-confidence {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.cv-confidence-head {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.cv-confidence-head::-webkit-details-marker {
  display: none;
}
.cv-confidence-head:hover {
  background: #f8fafc;
}
.cv-confidence-label {
  flex: 1;
}
.cv-confidence-mae {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.cv-confidence-body {
  padding: 4px 16px 14px 44px;
}
.pill-sm {
  font-size: 10px;
  padding: 2px 8px;
}

/* What-if analysis card */
.cv-whatif {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.cv-whatif-head {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.cv-whatif-head::-webkit-details-marker {
  display: none;
}
.cv-whatif-head:hover {
  background: #f8fafc;
}
.cv-whatif-label {
  flex: 1;
}
.cv-whatif-hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.cv-whatif-body {
  padding: 4px 16px 14px 44px;
}
.cv-whatif-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cv-whatif-header {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cv-whatif-header span {
  flex: 1;
  text-align: center;
}
.cv-whatif-header span:first-child {
  text-align: left;
}
.cv-whatif-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed #eef0f4;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.cv-whatif-row:last-child {
  border-bottom: none;
}
.cv-whatif-row span {
  flex: 1;
  text-align: center;
}
.cv-whatif-row span:first-child {
  text-align: left;
}
.cv-whatif-row--current {
  background: #f0f7ff;
  margin: 0 -16px;
  padding: 7px 16px;
  border-radius: 4px;
  font-weight: 700;
}

/* Mini sparkline in assumptions */
.cv-monthly-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
  padding: 4px 0;
}
.cv-spark-bar {
  flex: 1;
  background: var(--accent);
  opacity: 0.35;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: opacity 0.15s;
}
.cv-spark-bar:hover {
  opacity: 0.7;
}
.cv-spark-labels {
  display: flex;
  gap: 3px;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
}
.cv-spark-labels span {
  flex: 1;
  text-align: center;
}

/* Two-column layout for calculation tab */
.cv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.cv-grid-left {
  min-width: 0;
}
.cv-grid-right {
  min-width: 0;
}
@media (max-width: 900px) {
  .cv-grid {
    grid-template-columns: 1fr;
  }
}

/* Inline sales trend chart (Chart.js canvas) */
.cv-trend {
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
}
.cv-trend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.cv-trend-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.cv-trend-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.cv-trend-granularity {
  width: auto;
  min-width: 90px;
}
.cv-trend-caption {
  font-size: 11px;
  margin-top: 6px;
}

/* Demand / forecast context cards */
.cv-context {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.cv-context + .cv-context {
  margin-top: 6px;
}
.cv-context-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  user-select: none;
}
.cv-context-head::-webkit-details-marker {
  display: none;
}
.cv-context-head:hover {
  background: #f8fafc;
}
.cv-context-label {
  flex: 1;
}
.cv-context-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.cv-context-body {
  padding: 2px 16px 14px 44px;
}
.cv-context[open] > summary .cv-row-chevron {
  transform: rotate(90deg);
}

/* Muted num variant for flat rows */
.cv-row-num--muted {
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}

.placeholder-card {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: #111827;
}

.checkbox-inline input {
  width: 16px;
  height: 16px;
}

.forecast-chart {
  height: 280px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.forecast-chart-caption {
  overflow-wrap: break-word;
  max-width: 100%;
}

.forecast-table {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.forecast-table-title {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.data-table-compact th,
.data-table-compact td {
  padding: 8px 12px;
  font-size: 12px;
}

.text-right {
  text-align: right;
}

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

.detail-list dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

/* detail-list modifiers */
.detail-list--horizontal div {
  grid-template-columns: 140px 1fr;
  gap: 8px;
  align-items: baseline;
}
.detail-list--horizontal dt {
  text-transform: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
  color: var(--muted);
}

.detail-list--divided > div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.detail-list--divided > div:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.long-text {
  margin: 0;
  color: #334155;
  line-height: 1.5;
  word-break: break-word;
}

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  font-size: 12px;
  overflow-x: auto;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 50;
}

.toast[data-variant="error"] {
  background: #991b1b;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

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

  .dashboard-with-feed {
    grid-template-columns: 1fr;
  }

  .dashboard-activity-feed {
    position: static;
  }

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

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

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    position: static;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
  }

  .main {
    margin-left: 0;
  }
}

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

  .form-field-wide {
    grid-column: span 1;
  }
}

.panel-body {
  display: grid;
  gap: 12px;
}

.wizard-header {
  padding: 2px 0 4px;
  margin-bottom: 4px;
}

.wizard-steps {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 0;
  justify-content: space-between;
  width: 100%;
}

.wizard-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  flex: 1 1 0;
  min-width: 0;
}

.wizard-step.is-active {
  background: var(--accent-weak);
  color: var(--ink);
  border-color: #c7d2fe;
}

.wizard-step.is-complete {
  background: #e2f3ff;
  color: var(--ink);
  border-color: #bae6fd;
}

.wizard-step-index {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  color: #334155;
}

.wizard-step.is-active .wizard-step-index {
  background: var(--accent);
  color: #fff;
}

.wizard-step.is-complete .wizard-step-index {
  background: #0ea5e9;
  color: #fff;
}

.wizard-step-title {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 2px;
}

.wizard-step-sub {
  font-size: 10px;
  color: inherit;
}

.wizard-step-line {
  height: 2px;
  flex: 1 1 0;
  background: var(--line);
  border-radius: 999px;
}

.wizard-progress {
  display: none;
}

.wizard-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: 999px;
}

.progress-bar {
  background: #e5e7eb;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  width: 100%;
  height: 100%;
}

.progress-bar--indeterminate .progress-bar-fill {
  width: 40%;
  min-width: 80px;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.hidden { display: none !important; }

.wizard-actions {
  margin-top: 12px;
}

.wizard-actions-split {
  justify-content: space-between;
}

.wizard-actions-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* PO builder step 1: top suppliers as cards */
.po-build-suppliers-section {
  margin-bottom: 24px;
}
.po-build-suppliers-heading {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.po-build-suppliers-sub {
  margin: 0 0 12px;
  font-size: 13px;
}
.po-build-supplier-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.po-build-supplier-card-wrap {
  margin: 0;
}
.po-build-supplier-card {
  display: block;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 10px);
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #0f172a);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.po-build-supplier-card:hover {
  background: var(--surface, #f1f5f9);
  border-color: var(--accent, #3b82f6);
}
.po-build-supplier-card-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.po-build-other-suppliers {
  margin-top: 0;
}

.is-hidden {
  display: none;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pill-list li {
  background: #f3f4f6;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

/* ══════════════════════════════════════════════════════════
   WORKFLOW BUILDER — full-screen canvas mode
   ══════════════════════════════════════════════════════════ */

/* ── full-screen layout when builder is active ──────────── */
body[data-workflow-builder] { background: #fff !important; padding: 0 !important; --shell-gutter: 0px; }
body[data-workflow-builder] .app-shell { padding: 0 !important; background: #fff; }
body[data-workflow-builder] .sidebar { display: none !important; }
body[data-workflow-builder] .sidebar-corner { display: none !important; }
body[data-workflow-builder] .sidebar-hover-zone { display: none !important; }
body[data-workflow-builder] .header-bar { display: none !important; }
body[data-workflow-builder] .main { min-height: 100vh; border-radius: 0 !important; background: #fff; }
body[data-workflow-builder] .content { padding: 0; overflow: hidden; }
body[data-workflow-builder] .topbar { border-bottom: 1px solid #e2e8f0; padding: 0; height: 52px; border-radius: 0; }
body[data-workflow-builder] .flash { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); z-index: 100; min-width: 300px; }
body[data-workflow-builder] .toast { z-index: 200; }
.toast.wf-toast { display: flex; align-items: center; gap: 7px; pointer-events: auto; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.toast.wf-toast--error { background: #991b1b; }
.toast.wf-toast--success { background: #166534; }

/* ── workflow header bar ────────────────────────────────── */
.wf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 0 16px;
}
.wf-header__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wf-header__name {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.wf-header__badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.wf-header__badge--draft {
  background: #f1f5f9;
  color: #64748b;
}
.wf-header__badge--active {
  background: #dcfce7;
  color: #16a34a;
}
.wf-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wf-header__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s ease;
}
.wf-header__btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.wf-header__btn--outline { background: #fff; }
.wf-header__btn--primary { background: #18181b; color: #fff; border-color: #18181b; }
.wf-header__btn--primary:hover { background: #27272a; }
.wf-header__btn--green { background: #16a34a; color: #fff; border-color: #16a34a; }
.wf-header__btn--green:hover { background: #15803d; }
.wf-header__btn svg { flex-shrink: 0; }
.wf-header__close {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: #64748b;
  text-decoration: none;
  transition: all .12s ease;
}
.wf-header__close:hover { background: #f1f5f9; color: #1e293b; }

/* ── dropdown ───────────────────────────────────────────── */
.wf-header__dropdown { position: relative; }
.wf-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 10px 25px rgba(0,0,0,.1);
  z-index: 50;
}
.wf-dropdown.is-open { display: block; }
.wf-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  font-size: 13px;
  color: #334155;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.wf-dropdown__item:hover { background: #f1f5f9; }
.wf-dropdown__item:disabled { opacity: 0.4; cursor: default; }
.wf-dropdown__item:disabled:hover { background: none; }
.wf-dropdown__item--danger { color: #dc2626; }
.wf-dropdown__item--danger:hover { background: #fef2f2; }
.wf-dropdown__item svg { flex-shrink: 0; }
.wf-dropdown__sep { border: none; border-top: 1px solid #f1f5f9; margin: 4px 0; }

/* ── rename modal ───────────────────────────────────────── */
.wf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  display: grid;
  place-items: center;
  z-index: 200;
}
.wf-modal-overlay.is-hidden { display: none; }
.wf-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.wf-modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.wf-modal .input { width: 100%; }
.wf-modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── canvas (full-viewport) ─────────────────────────────── */
.wf-canvas {
  position: relative;
  height: calc(100vh - 52px);
  overflow: hidden;
  background:
    radial-gradient(circle, #d4d8dd 0.8px, transparent 0.8px);
  background-size: 20px 20px;
  background-color: #f8fafc;
  cursor: grab;
}
.wf-canvas.is-panning { cursor: grabbing; }
.wf-canvas.is-panning * { cursor: grabbing !important; user-select: none !important; }
.wf-canvas__graph {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 32px 120px;
  min-height: 100%;
  min-width: fit-content;
  will-change: transform;
}

/* ── right-side panels ─────────────────────────────────── */
.wf-panel {
  position: fixed;
  top: 52px;
  right: 0;
  width: 510px;
  height: calc(100vh - 52px);
  background: #fff;
  border-left: 1px solid #e2e8f0;
  z-index: 20;
  overflow-y: auto;
  padding: 16px;
  box-shadow: -4px 0 20px rgba(0,0,0,.05);
}
.wf-panel.is-hidden { display: none; }
.wf-panel--empty { display: flex; align-items: center; justify-content: center; padding: 0; }
.wf-panel--empty.is-hidden { display: none; }
.wf-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.wf-panel__title { font-size: 15px; font-weight: 600; color: #1e293b; }
.wf-panel__close {
  width: 28px; height: 28px;
  border: none; background: none; color: #94a3b8;
  border-radius: 6px; cursor: pointer; display: grid; place-items: center;
}
.wf-panel__close:hover { background: #f1f5f9; color: #1e293b; }
.wf-panel__desc {
  font-size: 12px; color: #64748b; line-height: 1.5; margin-bottom: 16px;
}
.wf-panel__desc:empty { display: none; }
.wf-panel__readonly {
  font-size: 13px; color: #1e293b; font-weight: 500;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.wf-panel__hint { font-size: 13px; color: #94a3b8; }

/* ── action catalog (side panel) ──────────────────────── */
.wf-action-catalog {
  position: fixed;
  top: 52px;
  right: 0;
  width: 380px;
  height: calc(100vh - 52px);
  background: #fff;
  border-left: 1px solid #e2e8f0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,.06);
}
.wf-action-catalog.is-hidden { display: none; }
.wf-action-catalog .wf-panel__header { padding: 16px; margin: 0; border-bottom: 1px solid #e2e8f0; }
.wf-catalog__search { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.wf-catalog__search .input { width: 100%; }
.wf-catalog__body { flex: 1; overflow-y: auto; padding: 8px; }
.wf-catalog__category {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: none;
  background: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .1s ease;
}
.wf-catalog__category:hover { background: #f8fafc; }
.wf-catalog__cat-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: #f1f5f9; border-radius: 8px; color: #475569; flex-shrink: 0;
}
.wf-catalog__cat-icon svg { width: 18px; height: 18px; fill: currentColor; }
.wf-catalog__cat-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wf-catalog__cat-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.wf-catalog__cat-count { font-size: 11px; color: #94a3b8; }
.wf-catalog__cat-arrow { width: 16px; height: 16px; fill: #94a3b8; flex-shrink: 0; }
.wf-catalog__back {
  display: flex; align-items: center; gap: 6px;
  border: none; background: none; color: #64748b; font-size: 12px;
  padding: 8px 12px; cursor: pointer; border-radius: 6px; margin-bottom: 4px;
}
.wf-catalog__back:hover { background: #f1f5f9; color: #1e293b; }
.wf-catalog__action {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; padding: 10px 12px; border: none; background: none;
  border-radius: 8px; cursor: pointer; text-align: left; transition: background .1s ease;
}
.wf-catalog__action:hover { background: #f8fafc; }
.wf-catalog__action-name { font-size: 13px; font-weight: 500; color: #1e293b; }
.wf-catalog__action-desc { font-size: 11px; color: #94a3b8; line-height: 1.4; }
.wf-catalog__action--disabled { opacity: 0.55; cursor: not-allowed !important; }
.wf-catalog__action--disabled:hover { background: transparent; }
.wf-catalog__coming-soon {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #f59e0b;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.wf-catalog__empty { text-align: center; color: #94a3b8; font-size: 13px; padding: 32px 16px; }

/* ── schema fields (action config form) ─────────────────── */
.wf-field { margin-bottom: 16px; }
.wf-field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 4px;
}
.wf-field__required { color: #ef4444; }
.wf-field__input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #1a1a2e;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.wf-field__input:focus { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.12); }
.wf-field__textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.wf-field__select { appearance: auto; }
.wf-field__hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

/* ── column (one per subtree) ───────────────────────────── */
.fl-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── zone: card + add-bar; children outside ─────────────── */
.fl-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* extend hover hit-area so the trash icon (right: -40px) stays reachable */
  padding: 0 48px;
  margin: 0 -48px;
}

/* ── card wrap (card + delete) ──────────────────────────── */
.fl-card-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* ── card ────────────────────────────────────────────────── */
.fl-card {
  width: 280px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.fl-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 6px 20px rgba(0,0,0,.06);
  border-color: #cbd5e1;
}
.fl-card--trigger { border-top: 3px solid #22c55e; }
.fl-card--condition { border-top: 3px solid #f59e0b; }
.fl-card--action { border-top: 3px solid #6366f1; }
.fl-card--placeholder {
  border: 2px dashed #cbd5e1;
  border-top: 3px solid #22c55e;
  background: #fafafa;
  cursor: pointer;
}
.fl-card--placeholder:hover { border-color: #94a3b8; background: #f1f5f9; }
.fl-card--placeholder .fl-card__title { color: #64748b; }
.fl-card--placeholder .fl-card__sub { color: #94a3b8; }

.fl-card__head { display: flex; align-items: flex-start; gap: 10px; }
.fl-card__icon { flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; margin-top: 1px; }
.fl-card__icon svg { width: 18px; height: 18px; }
.fl-card__body { flex: 1; min-width: 0; }
.fl-card__title { font-weight: 600; font-size: 13px; color: #1e293b; line-height: 1.3; }
.fl-card__sub { font-size: 11.5px; color: #94a3b8; line-height: 1.35; margin-top: 2px; }

/* condition badges — full-width row below the head */
.fl-card__badges { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid #f1f5f9; }
.fl-badge { font-size: 11px; color: #64748b; }
.fl-badge--true { color: #16a34a; }
.fl-badge--false { color: #dc2626; }

/* ── delete button ──────────────────────────────────────── */
.fl-delete {
  position: absolute; right: -40px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid #e2e8f0;
  background: #fff; color: #94a3b8; display: grid; place-items: center;
  opacity: 0; pointer-events: none; transition: opacity .15s ease; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.fl-zone:hover .fl-delete { opacity: 1; pointer-events: auto; }
.fl-delete:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.fl-delete svg { width: 14px; height: 14px; fill: currentColor; }

/* ── connector line ─────────────────────────────────────── */
.fl-connector { width: 2px; height: 28px; background: #94a3b8; position: relative; flex-shrink: 0; }
.fl-connector::after { content: ""; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #94a3b8; }

/* ── add-row (action / condition pill) ──────────────────── */
.fl-add-row {
  display: flex; justify-content: center; gap: 12px;
  height: 0; overflow: visible; opacity: 0; pointer-events: none;
  transition: opacity .15s ease, height .15s ease;
  position: relative; z-index: 4;
}
.fl-zone:hover > .fl-add-row { height: 36px; opacity: 1; pointer-events: auto; }
.fl-add-row--split { gap: 20px; }

.fl-pill { display: inline-flex; align-items: center; gap: 2px; background: #18181b; border-radius: 999px; padding: 3px 4px; box-shadow: 0 4px 12px rgba(0,0,0,.20); }
.fl-pill__label { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.5); padding: 0 6px; }
.fl-pill__btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: transparent; color: #fff; font-size: 11px; cursor: pointer; padding: 4px 10px; border-radius: 999px; transition: background .12s ease; white-space: nowrap; }
.fl-pill__btn:hover { background: rgba(255,255,255,.14); }
.fl-pill__btn svg { width: 12px; height: 12px; fill: #fff; }

/* ── branches (condition forks) ─────────────────────────── */
.fl-branches { display: flex; justify-content: center; gap: 32px; position: relative; padding-top: 36px; }
.fl-branches::after { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 12px; background: #94a3b8; transform: translateX(-50%); }
.fl-branches::before { content: ""; position: absolute; top: 12px; left: var(--bar-left, 25%); right: var(--bar-right, 25%); height: 2px; background: #94a3b8; }

.fl-lane { display: flex; flex-direction: column; align-items: center; position: relative; min-width: 200px; }
.fl-lane::before { content: ""; position: absolute; top: -24px; left: 50%; width: 2px; height: 24px; background: #94a3b8; transform: translateX(-50%); }
.fl-lane::after { content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #94a3b8; }
.fl-lane-empty { height: 40px; width: 1px; }

/* condition-specific branches: fork from badge positions, not center */
.fl-branches--condition { padding-top: 28px; }
.fl-branches--condition::after {
  /* Two vertical stems dropping from badge positions (card edges) */
  content: "";
  position: absolute;
  top: 0;
  left: calc(50% - 120px);
  right: calc(50% - 120px);
  height: 12px;
  width: auto;
  transform: none;
  background:
    linear-gradient(#94a3b8, #94a3b8) left / 2px 100% no-repeat,
    linear-gradient(#94a3b8, #94a3b8) right / 2px 100% no-repeat;
}
.fl-branches--condition::before {
  /* Horizontal bar extends from badge stems to lane centers */
  top: 12px;
  left: min(var(--bar-left, 25%), calc(50% - 120px));
  right: min(var(--bar-right, 25%), calc(50% - 120px));
}
.fl-branches--condition > .fl-lane::before { top: -16px; height: 16px; }

/* ══════════════════════════════════════════════════════════
   WORKFLOW SHOW PAGE
   ══════════════════════════════════════════════════════════ */

/* ── canvas preview card ──────────────────────────────────── */
.wf-show-canvas-preview {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  background-image: radial-gradient(circle, #d4d8dd 0.8px, transparent 0.8px);
  background-size: 20px 20px;
  background-color: #f8fafc;
}

.wf-show-preview-card {
  width: 280px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
.wf-show-preview-card--trigger { border-top: 3px solid #22c55e; }
.wf-show-preview-card--action  { border-top: 3px solid #6366f1; }
.wf-show-preview-card__title {
  font-weight: 600;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.3;
}
.wf-show-preview-card__sub {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
  margin-top: 3px;
}
.wf-show-preview-connector {
  width: 2px;
  height: 24px;
  background: #94a3b8;
  position: relative;
}
.wf-show-preview-connector::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #94a3b8;
}
.wf-show-preview-summary {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-top: 8px;
  padding: 6px 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.wf-show-preview-empty {
  text-align: center;
  color: #94a3b8;
  padding: 20px;
}
.wf-show-preview-empty p {
  margin: 8px 0 0;
  font-size: 13px;
}

/* ── runs panel ───────────────────────────────────────────── */
.wf-show-runs {
  padding: 0;
  overflow: hidden;
}
.wf-show-runs .panel-header {
  padding: 20px 24px 16px;
  margin-bottom: 0;
}
.wf-show-runs .panel-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.wf-show-runs .panel-header .muted {
  margin: 2px 0 0;
  font-size: 13px;
}
.wf-show-runs .data-table {
  width: 100%;
  border-collapse: collapse;
}
.wf-show-runs .data-table thead th {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: #fafbfc;
}
.wf-show-runs .data-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.wf-show-runs .data-table tbody tr:last-child td {
  border-bottom: none;
}
.wf-run-row:hover td {
  background: #fafbfc;
}
.wf-run-event {
  font-weight: 500;
  color: #1e293b;
}

/* error detail row */
.wf-run-error-detail td {
  padding: 0 16px 12px !important;
  border-bottom: 1px solid #f1f5f9 !important;
}
.wf-run-error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #991b1b;
  line-height: 1.5;
}
.btn-text-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-text-link:hover {
  color: #1d4ed8;
}

/* empty state */
.wf-show-runs-empty {
  text-align: center;
  padding: 48px 24px 56px;
}
.wf-show-runs-empty__icon {
  margin-bottom: 12px;
}
.wf-show-runs-empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 6px;
}
.wf-show-runs-empty .muted {
  font-size: 13px;
  margin: 0;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   WORKFLOW RUN DETAIL PAGE
   ══════════════════════════════════════════════════════════ */

.wf-run-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 800px) {
  .wf-run-detail-summary { grid-template-columns: repeat(2, 1fr); }
}

.wf-run-error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: #991b1b;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ── steps panel ──────────────────────────────────────────── */
.wf-run-detail-steps {
  padding: 0;
  overflow: hidden;
}
.wf-run-detail-steps .panel-header {
  padding: 20px 24px 16px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
.wf-run-detail-steps .panel-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

/* ── timeline ─────────────────────────────────────────────── */
.wf-run-timeline {
  padding: 20px 24px;
}
.wf-run-step {
  display: flex;
  gap: 14px;
}
.wf-run-step__indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 28px;
}
.wf-run-step__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  color: #64748b;
  flex-shrink: 0;
}
.wf-run-step__dot--success { background: #dcfce7; color: #16a34a; }
.wf-run-step__dot--failed  { background: #fee2e2; color: #dc2626; }
.wf-run-step__dot--running { background: #fef3c7; color: #f59e0b; }
.wf-run-step__line {
  width: 2px;
  flex: 1;
  min-height: 16px;
  background: #e2e8f0;
}

.wf-run-step__content {
  flex: 1;
  min-width: 0;
  padding-bottom: 20px;
}
.wf-run-step:last-child .wf-run-step__content { padding-bottom: 0; }

.wf-run-step__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.wf-run-step__title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  line-height: 1.4;
}
.wf-run-step__type {
  font-size: 12px;
  margin: 1px 0 0;
}
.wf-run-step__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* error box */
.wf-run-step__error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #991b1b;
  line-height: 1.5;
  margin-top: 8px;
}

/* output toggle */
.wf-run-step__output { margin-top: 8px; }
.wf-run-step__output-toggle {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 4px 0;
}
.wf-run-step__output-toggle::-webkit-details-marker { display: none; }
.wf-run-step__output-toggle::before {
  content: "▸ ";
  font-size: 10px;
}
details[open] > .wf-run-step__output-toggle::before {
  content: "▾ ";
}
.wf-run-step__output-json {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-family: "SF Mono", "Fira Code", monospace;
  color: #334155;
  line-height: 1.5;
  overflow-x: auto;
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* JSON block (event payload, canvas snapshot) */
.wf-run-json-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  font-family: "SF Mono", "Fira Code", monospace;
  color: #334155;
  line-height: 1.5;
  overflow-x: auto;
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Procurement module ────────────────────────────────────────── */

/* Metric strip */
.metric-strip {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  overflow-x: auto;
}
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 140px;
  flex: 1;
}
.metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}
.metric-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.metric-sub {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Legacy procurement layout (kept for backwards compat) */
.procurement-show {
  padding: 0 24px 40px;
}
.procurement-show > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Detail page layout (wide main + narrow sidebar) ─── */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 0 24px 40px;
  align-items: start;
}
.detail-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.detail-sidebar {
  position: sticky;
  top: 16px;
  z-index: 0;
}
.detail-sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Panel index header (embedded index-style controls) ─ */
.panel-index-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-index-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.panel-index-title .muted {
  margin: 2px 0 0;
  font-size: 12px;
}
.panel-index-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}
.panel-index-search-form {
  display: flex;
  align-items: center;
  flex: 1;
}
.panel-index-search-form .search-compact {
  min-width: 200px;
  border: 1px solid var(--line);
  font-size: 13px;
}
.panel-index-filters {
  padding: 8px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.panel-index-filters .search {
  background: var(--panel, #fff);
  border: 1px solid var(--line);
}
.panel-index-filters .search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.panel-index-filters .filters-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.panel-index-filters-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.panel-index-filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.panel-line-items {
  overflow: visible;
}

/* Line items panel: expand to fullscreen */
.line-items-panel-wrapper {
  position: relative;
}
.line-items-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.line-items-expand-btn:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
}
/* Fullscreen via Fullscreen API – browser hides header/sidebar */
.line-items-panel-wrapper:fullscreen {
  background: var(--panel, #fff);
  overflow: auto;
  padding: 0;
  display: block;
}
.line-items-panel-wrapper:fullscreen .panel {
  min-height: 100%;
  border-radius: 0;
  border: none;
  box-shadow: none;
}
.line-items-panel-wrapper:-webkit-full-screen {
  background: var(--panel, #fff);
  overflow: auto;
  padding: 0;
  display: block;
}
.line-items-panel-wrapper:-webkit-full-screen .panel {
  min-height: 100%;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

/* ── Remaining recommendations card (PO show) ── */
.remaining-recs-panel {
  margin-top: 16px;
  border: 1px dashed var(--line, #e2e8f0);
  background: #f8fafc;
}
.remaining-recs-body {
  padding: 16px 20px 20px;
}
.remaining-recs-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
}
.remaining-recs-stat {
  display: flex;
  flex-direction: column;
  min-width: 90px;
}
.remaining-recs-stat-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary, #1e293b);
}
.remaining-recs-stat-label {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}
.remaining-recs-stat-hint {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  margin-top: 1px;
}
.remaining-recs-stat-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.remaining-recs-stat-link:hover .remaining-recs-stat-value {
  text-decoration: underline;
}
.remaining-recs-stat--warning .remaining-recs-stat-value {
  color: var(--warning, #d97706);
}
.remaining-recs-stat--warning .remaining-recs-stat-link:hover .remaining-recs-stat-value {
  color: var(--warning, #d97706);
}
.remaining-recs-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Review scopes bar (between filters and line items table) */
.panel-index-scopes {
  padding: 6px 16px 8px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.panel-index-scopes .scopes-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.panel-index-scopes .scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.panel-index-scopes .scope-pill:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #334155;
}
.panel-index-scopes .scope-pill.is-active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.panel-index-scopes .scope-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  background: #e2e8f0;
  border-radius: 999px;
  color: #475569;
}
.panel-index-scopes .scope-pill.is-active .scope-pill-count {
  background: #bfdbfe;
  color: #1d4ed8;
}

/* View switcher inside panel */
.view-switcher-panel summary {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.view-switcher-panel h2 {
  display: inline;
}

/* ── Sidebar list (compact list of invoices/shipments) ── */
.sidebar-list {
  padding: 0;
}
.sidebar-list-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.sidebar-list-item:last-child {
  border-bottom: none;
}
.sidebar-list-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}
.sidebar-list-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* Small status badge variant */
.status-badge--sm {
  font-size: 10px;
  padding: 1px 6px;
}

/* Small discrepancy badge */
.discrepancy-badge--sm {
  font-size: 10px;
  padding: 1px 6px;
}

/* Small progress bar */
.progress-bar-wrap-sm {
  min-width: 80px;
  font-size: 11px;
}
.progress-bar-wrap-sm .progress-bar {
  height: 4px;
}

/* ── Fulfillment progress bar (metric strip) ─────────── */
.metric-card--wide {
  flex: 2;
  min-width: 240px;
}
.fulfillment-bar-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.fulfillment-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
}
.fulfillment-segment {
  height: 100%;
  transition: width 0.3s ease;
}
.fulfillment-segment--received {
  background: #22c55e;
}
.fulfillment-segment--incoming {
  background: #f59e0b;
}
.fulfillment-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.fulfillment-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.fulfillment-legend-item strong {
  color: var(--ink);
  font-weight: 600;
}
.fulfillment-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.fulfillment-dot--received {
  background: #22c55e;
}
.fulfillment-dot--incoming {
  background: #f59e0b;
}
.fulfillment-dot--on-order {
  background: #e2e8f0;
}

/* ── PO Show header ──────────────────────────────────── */
.po-topbar-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.po-topbar-heading h1 {
  margin: 0;
  font-size: 18px;
}

/* ── PO Show tabs layout ─────────────────────────────── */
.po-show__tabs {
  min-width: 0;
  margin-top: -24px;
  margin-left: -24px;
  margin-right: -24px;
  width: calc(100% + 48px);
  display: flex;
  flex-direction: column;
}
.po-show__tabs > .tabs__bar {
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
  margin-top: 0;
  margin-bottom: 0;
}
.po-show__tabs > .tabs__panel {
  padding-top: 0;
  width: 100%;
  box-sizing: border-box;
}
.po-show__panel--line-items {
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}
.po-show__panel--line-items > .metric-strip {
  padding-top: 20px;
}
.po-show__panel--line-items > .detail-layout {
  padding-top: 0;
}
.po-show__panel--full {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px 40px;
  box-sizing: border-box;
}
.po-show__panel--full > .panel,
.po-show__panel--full > .panel.table-panel {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.po-tab-kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 768px) {
  .po-tab-kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

/* Panel footer row — used in table panels beneath a table */
.panel-footer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  font-size: 13px;
}
.panel-footer-spacer {
  flex: 1;
}
.panel-footer-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* Hint text below a form field */
.form-hint {
  margin: 6px 0 10px;
}
.po-tab-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 900px) {
  .po-tab-two-col {
    grid-template-columns: 1fr 360px;
  }
  .po-tab-two-col--equal {
    grid-template-columns: 1fr 1fr;
  }
}
.po-tab-two-col__wide {
  min-width: 0;
}
.po-tab-two-col__side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.po-tab-two-col__side .panel {
  width: 100%;
  max-width: none;
}
.data-table-footer-row td {
  border-top: 2px solid var(--line);
  background: #f8fafc;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 0.85rem;
}
.data-table-footer-row td strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink);
}

/* ── PO Status stepper ───────────────────────────────── */
.po-stepper-body {
  padding: 12px 16px 16px;
}
.po-stepper-cancelled {
  text-align: center;
  padding: 8px 0;
}
.po-stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.po-stepper-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  padding: 6px 0;
}
.po-stepper-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: -6px;
  width: 2px;
  background: #e2e8f0;
}
.po-stepper-step--completed:not(:last-child)::after {
  background: #22c55e;
}
.po-stepper-step--active:not(:last-child)::after {
  background: linear-gradient(to bottom, #3b82f6 0%, #e2e8f0 100%);
}
.po-stepper-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  z-index: 1;
}
.po-stepper-step--completed .po-stepper-indicator {
  background: #dcfce7;
  color: #16a34a;
}
.po-stepper-step--active .po-stepper-indicator {
  background: #dbeafe;
  color: #2563eb;
}
.po-stepper-step--upcoming .po-stepper-indicator {
  background: #f1f5f9;
  color: #94a3b8;
}
.po-stepper-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.po-stepper-step--active .po-stepper-dot {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.po-stepper-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-top: 2px;
  min-width: 0;
}
.po-stepper-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.po-stepper-step--upcoming .po-stepper-label {
  color: var(--muted);
  font-weight: 500;
}
.po-stepper-date {
  font-size: 11px;
  color: var(--muted);
}
.po-stepper-date--vendor {
  color: var(--ink);
  font-weight: 500;
}

.po-sidebar-fx-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.po-sidebar-fx-list li {
  margin: 0;
}

/* ── Contextual banner ───────────────────────────────── */
.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}
.banner p {
  margin: 0;
}
.banner--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* ── Panel empty state ───────────────────────────────── */
.panel-empty-state {
  padding: 12px 16px;
  font-size: 12px;
}
.panel-empty-state .muted {
  margin: 0 0 4px;
}

/* ── Sidebar resolved flag item ──────────────────────── */
.sidebar-list-item--resolved {
  opacity: 0.5;
}

/* ── Sidebar conversations ───────────────────────────── */
.sidebar-threads {
  padding: 8px 16px 12px;
}
.sidebar-thread-item {
  padding: 4px 0;
  border-bottom: 1px solid var(--soft);
}
.sidebar-thread-link {
  font-size: 12px;
}
.sidebar-thread-date {
  font-size: 11px;
}
.sidebar-threads-footer {
  padding-top: 6px;
}
.sidebar-threads-view-all {
  font-size: 12px;
  color: var(--accent);
}

/* ── Sidebar vendor flag helpers ─────────────────────── */
.sidebar-list-item-meta--stacked {
  flex-direction: column;
  align-items: flex-start;
}
.sidebar-flag-notes {
  font-size: 0.8rem;
  margin: 2px 0;
}
.sidebar-flag-photos {
  font-size: 0.75rem;
  margin: 0;
}
.sidebar-flag-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.sidebar-flag-form {
  display: inline;
}
.sidebar-flag-resolved-label {
  font-size: 0.75rem;
}

/* ── Detail notes (long text in details panel) ───────── */
.detail-notes {
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Activity feed (sidebar timeline) ────────────────── */
.activity-feed-panel .panel-body {
  padding: 12px 16px;
}
.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.activity-feed__entry {
  margin: 0;
  padding: 0;
}
.activity-feed__row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.activity-feed__entry:last-child .activity-feed__row {
  border-bottom: none;
}
.activity-feed__avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.activity-feed__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.activity-feed__avatar-icon {
  font-size: 12px;
  opacity: 0.9;
}
.activity-feed__connector {
  width: 2px;
  flex: 1;
  min-height: 12px;
  background: var(--line);
  margin-top: 4px;
}
.activity-feed__entry:last-child .activity-feed__connector {
  display: none;
}
.activity-feed__body {
  flex: 1;
  min-width: 0;
}
.activity-feed__summary {
  margin: 0 0 2px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text, #0f172a);
}
.activity-feed__meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.activity-feed__toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  color: inherit;
}
.activity-feed__toggle:hover {
  color: var(--accent);
}
.activity-feed__detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  transition: opacity 0.2s ease;
}
.activity-feed-empty {
  margin: 0 0 8px;
  font-size: 13px;
}
.activity-feed-footer {
  margin: 8px 0 0;
  font-size: 12px;
}
.activity-feed-detail__meta {
  margin: 0 0 10px;
  font-size: 12px;
}
.activity-feed-detail__changes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.activity-feed-detail__version {
  font-size: 12px;
  padding: 8px 10px;
  background: var(--surface, #f8fafc);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.activity-feed-detail__record-type {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 600;
}
.activity-feed-detail__change {
  margin: 2px 0;
  font-size: 12px;
}
.activity-feed-detail__change .audit-old {
  color: var(--muted);
}
.activity-feed-detail__change .audit-new {
  font-weight: 500;
}
.activity-feed-detail__footer {
  margin: 12px 0 0;
  font-size: 12px;
}

/* ── Dashboard checklist ─────────────────────────────────── */
.dashboard-checklist {
  margin-top: 1rem;
}
.dashboard-checklist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}
.dashboard-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.dashboard-checklist-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.dashboard-checklist-check svg {
  width: 18px;
  height: 18px;
}
.dashboard-checklist-check-empty {
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
}
.dashboard-checklist-item.is-completed .dashboard-checklist-label {
  color: var(--muted);
}
.dashboard-checklist-label.link:hover {
  color: var(--accent);
}

/* ── Warning variant metric strip ────────────────────── */
.metric-strip--warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  margin: 0 24px;
}
.metric-card--warning {
  background: #fef3c7;
  border-color: #fcd34d;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
.status-badge--draft { background: #f1f5f9; color: #475569; }
.status-badge--pending_approval,
.status-badge--pending_review,
.status-badge--pending { background: #fef3c7; color: #92400e; }
.status-badge--approved,
.status-badge--accepted { background: #dcfce7; color: #166534; }
.status-badge--submitted_to_supplier,
.status-badge--in_transit { background: #dbeafe; color: #1e40af; }
.status-badge--partially_invoiced { background: #e0e7ff; color: #3730a3; }
.status-badge--fully_invoiced { background: #d1fae5; color: #065f46; }
.status-badge--reconciled,
.status-badge--received { background: #d1fae5; color: #065f46; }
.status-badge--disputed { background: #fee2e2; color: #991b1b; }
.status-badge--cancelled { background: #fecaca; color: #991b1b; }
.status-badge--closed { background: #e5e7eb; color: #4b5563; }
.status-badge--paid { background: #d1fae5; color: #065f46; }
.status-badge--unpaid { background: #fef3c7; color: #92400e; }
.status-badge--partially_paid { background: #dbeafe; color: #1e40af; }
.status-badge--partial { background: #fef3c7; color: #92400e; }
.status-badge--arrived { background: #dbeafe; color: #1e40af; }
.status-badge--receiving { background: #fef3c7; color: #92400e; }

/* Bundle type badges (variant show) – colored background so they stand out */
.status-badge--bundle-virtual { background: #c7d2fe; color: #3730a3; }
.status-badge--bundle-assembly { background: #fed7aa; color: #9a3412; }
.status-badge--bundle-multipack { background: #e9d5ff; color: #6b21a8; }

/* Discrepancy badge */
.discrepancy-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #fef2f2;
  color: #dc2626;
}

/* Text colors */
.text-danger { color: #dc2626; }
.text-success { color: #16a34a; }
.text-warning { color: #d97706; }
.text-sm { font-size: 12px; }

/* Progress bars */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.progress-bar-wrap .progress-bar {
  height: 6px;
  background: #2563eb;
  border-radius: 3px;
  flex: 1;
  max-width: 80px;
  position: relative;
}
.progress-bar-wrap .progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #e2e8f0;
  border-radius: 3px;
  z-index: -1;
  width: 80px;
}
.progress-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.progress-bar-large-wrap {
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  margin: 12px 20px 16px;
}
.progress-bar-large {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* Panel filter bar */
.panel-filter-bar {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

/* Panel header actions */
.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Panel warning variant */
.panel-warning {
  border: 1px solid #fde68a;
  background: #fffbeb;
}
.panel-warning .panel-header {
  border-bottom-color: #fde68a;
}

/* Panel total secondary */
.panel-total-secondary {
  font-size: 13px;
  margin: 2px 0 0;
}

/* Row highlight variants */
.row-highlight-warning td { background: #fffbeb; }
.row-highlight-info td { background: #eff6ff; }

/* Inline forms */
.inline-form {
  padding: 12px 16px;
}
.inline-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.input-narrow {
  max-width: 80px;
}

/* Upload form */
.upload-form {
  padding: 4px 0;
}

/* Panel body */
.panel-body {
  padding: 12px 16px;
}

/* Reconciliation report */
.reconciliation-report {
  padding: 0 24px 40px;
}
.reconciliation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.recon-stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.recon-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
}
.recon-stat-value {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
}
.recon-stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Inline checkbox */
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ── Quick Receive ────────────────────────────────────────── */

.qr-panel {
  margin-bottom: 16px;
}

.qr-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.qr-shipment-field {
  width: 180px;
  flex-shrink: 0;
}

.qr-shipment-field .input {
  min-width: 0;
  width: 100%;
}

.qr-scan-field-wrap {
  flex: 1;
  min-width: 0;
}

.qr-scan-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.qr-scan-input-wrap {
  position: relative;
  flex: 1;
}

.qr-scan-input-wrap .input {
  width: 100%;
  min-width: 0;
}

.qr-scan-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.qr-scan-input {
  padding-left: 40px !important;
  font-size: 15px !important;
  height: 42px;
}

.qr-search-btn {
  height: 42px;
  padding: 0 20px;
  white-space: nowrap;
}

.qr-results {
  margin-bottom: 24px;
}

.qr-receive-form {
  margin: 0;
}

.qr-receive-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.qr-qty-input {
  width: 64px !important;
  text-align: center;
}

.qr-qty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 6px;
  min-width: 32px;
}

.qr-recent {
  margin-top: 8px;
}

.row-muted td {
  opacity: 0.5;
}

/* ── Tags ─────────────────────────────────────────────────── */

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  white-space: nowrap;
}

.tag + .tag {
  margin-left: 4px;
}

.tag-subtle {
  background: var(--soft);
  color: var(--muted);
}

.tag-info {
  background: #dbeafe;
  color: #1e40af;
}

/* ── Button block ─────────────────────────────────────────── */

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* ── Toggle Switch ───────────────────────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch-track {
  width: 44px;
  height: 24px;
  background: var(--line);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--accent);
}

.toggle-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-switch-track::after {
  transform: translateX(20px);
}

.toggle-switch-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  user-select: none;
}

/* ── Responsive QR ────────────────────────────────────────── */

@media (max-width: 768px) {
  .qr-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .qr-shipment-field {
    min-width: 100%;
  }

  .qr-scan-input-row {
    flex-direction: column;
  }

  .qr-search-btn {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════
   WORKFLOW CONDITION BUILDER
   ══════════════════════════════════════════════════════════ */

.wf-cond-loading {
  font-size: 12px;
  color: #94a3b8;
  padding: 16px 0;
  text-align: center;
}

.wf-cond__logic {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.wf-cond__logic-label {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}
.wf-cond__logic-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all .12s ease;
}
.wf-cond__logic-btn:hover {
  border-color: #a5b4fc;
  color: #4f46e5;
}
.wf-cond__logic-btn.is-active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.wf-cond__rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.wf-cond__rule {
  display: flex;
  gap: 6px;
  align-items: center;
}
.wf-cond__field {
  flex: 1;
  min-width: 0;
  font-size: 12px !important;
  padding: 6px 8px !important;
}
.wf-cond__op {
  width: 120px;
  flex-shrink: 0;
  font-size: 12px !important;
  padding: 6px 8px !important;
}
.wf-cond__value {
  flex: 1;
  min-width: 0;
  font-size: 12px !important;
  padding: 6px 8px !important;
}
.wf-cond__remove {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: #94a3b8;
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all .12s ease;
}
.wf-cond__remove svg { width: 14px; height: 14px; fill: currentColor; }
.wf-cond__remove:hover {
  background: #fef2f2;
  color: #dc2626;
}

.wf-cond__add {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px dashed #d1d5db;
  background: none;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: all .12s ease;
}
.wf-cond__add svg { width: 14px; height: 14px; fill: currentColor; }
.wf-cond__add:hover {
  border-color: #6366f1;
  color: #6366f1;
  background: #f5f3ff;
}

/* ══════════════════════════════════════════════════════════
   WORKFLOW SIMULATION
   ══════════════════════════════════════════════════════════ */

.wf-sim__record-type {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.wf-sim__results-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 20px 0 4px;
}
.wf-sim__results-desc {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 14px;
  line-height: 1.5;
}

.wf-sim__timeline {
  display: flex;
  flex-direction: column;
}
.wf-sim__step {
  display: flex;
  gap: 12px;
}
.wf-sim__step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 28px;
}
.wf-sim__step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.wf-sim__step-dot--trigger { background: #dcfce7; color: #16a34a; }
.wf-sim__step-dot--condition { background: #fef3c7; color: #f59e0b; }
.wf-sim__step-dot--action { background: #e0e7ff; color: #6366f1; }
.wf-sim__step-line {
  width: 2px;
  flex: 1;
  min-height: 14px;
  background: #e2e8f0;
}
.wf-sim__step-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 16px;
}
.wf-sim__step:last-child .wf-sim__step-content { padding-bottom: 0; }

.wf-sim__step-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
}
.wf-sim__branch {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
}
.wf-sim__branch--true { background: #dcfce7; color: #166534; }
.wf-sim__branch--false { background: #fee2e2; color: #991b1b; }

.wf-sim__rule-summary {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  font-style: italic;
}
.wf-sim__would-run {
  display: block;
  font-size: 11px;
  color: #6366f1;
  margin-top: 4px;
  font-weight: 500;
}
.wf-sim__inputs {
  margin: 12px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.wf-sim__inputs .wf-field__label { font-size: 13px; font-weight: 600; }
.wf-sim__inputs .wf-field__hint { margin-bottom: 8px; }
.wf-sim__error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #991b1b;
  margin-top: 12px;
  line-height: 1.5;
}

/* ── Button trigger panel ─────────────────────────────── */
.wf-btn-trigger { display: flex; flex-direction: column; gap: 14px; }
.wf-btn-trigger__visibility,
.wf-btn-trigger__inputs { margin-top: 4px; }

/* ── Advanced options toggle ──────────────────────────── */
.wf-adv-toggle {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; color: #64748b;
  padding: 4px 0; margin-top: 2px;
}
.wf-adv-toggle:hover { color: #334155; }
.wf-adv-toggle__icon { transition: transform 0.15s; }
.wf-adv-toggle__icon.is-open { transform: rotate(90deg); }
.wf-adv-panel { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.wf-adv-panel.is-hidden { display: none; }

/* ── Icon picker ──────────────────────────────────────── */
.wf-icon-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.wf-icon-picker__btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #e2e8f0; border-radius: 6px; background: #fff;
  color: #64748b; cursor: pointer; transition: all 0.15s;
}
.wf-icon-picker__btn:hover { border-color: #cbd5e1; color: #334155; background: #f8fafc; }
.wf-icon-picker__btn.is-active { border-color: #6366f1; background: #eef2ff; color: #4f46e5; }

/* ── Input fields builder ─────────────────────────────── */
.wf-input-fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.wf-input-field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  position: relative;
}
.wf-input-field-row .wf-cond__remove {
  position: absolute;
  top: 8px;
  right: 8px;
}
.wf-input-field__label { font-size: 13px; }
.wf-input-field__key { font-size: 12px; color: #64748b; font-family: monospace; }
.wf-input-field__meta {
  display: flex;
  gap: 8px;
  align-items: center;
}
.wf-input-field__type { font-size: 12px; flex: 1; }
.wf-input-field__req { font-size: 12px; color: #64748b; white-space: nowrap; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.wf-input-field__req input { width: 14px; height: 14px; }

/* ── Schedule trigger panel ───────────────────────────── */
.wf-schedule-trigger { display: flex; flex-direction: column; gap: 14px; }
.wf-schedule__freq { display: flex; gap: 8px; align-items: center; }
.wf-schedule__freq-val { width: 70px; text-align: center; }
.wf-schedule__freq-unit { flex: 1; }

/* ── Field hint (used in trigger panels) ──────────────── */
.wf-field__hint {
  font-size: 12px;
  color: #94a3b8;
  margin: 0 0 6px 0;
  line-height: 1.4;
}

/* ── Liquid hint for action config ────────────────────── */
.wf-liquid-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  font-family: monospace;
}

/* ── Update record action rows ────────────────────────── */
.wf-update-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.wf-update-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 6px;
  align-items: start;
}
.wf-update-row .wf-field__textarea { min-height: 36px; resize: vertical; }

/* ── Workflow button on show pages ────────────────────── */
.wf-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.wf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}
.wf-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.wf-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wf-btn--loading { color: #94a3b8; }
.wf-btn svg { width: 14px; height: 14px; }

/* ── Workflow button input modal ──────────────────────── */
.wf-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.wf-modal {
  background: #fff; border-radius: 12px; width: 440px; max-width: 95vw;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.wf-modal__header {
  padding: 16px 20px; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
}
.wf-modal__header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.wf-modal__close {
  background: none; border: none; cursor: pointer; color: #94a3b8;
  padding: 4px; border-radius: 4px;
}
.wf-modal__close:hover { color: #334155; background: #f1f5f9; }
.wf-modal__body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.wf-modal__field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #334155; }
.wf-modal__field label .wf-modal__req { color: #ef4444; }
.wf-modal__field input,
.wf-modal__field textarea,
.wf-modal__field select {
  width: 100%; padding: 8px 10px; font-size: 13px; border: 1px solid #e2e8f0;
  border-radius: 6px; background: #fff;
}
.wf-modal__field textarea { resize: vertical; min-height: 60px; }
.wf-modal__footer {
  padding: 12px 20px; border-top: 1px solid #e2e8f0;
  display: flex; justify-content: flex-end; gap: 8px;
}
.wf-modal__btn {
  padding: 8px 18px; font-size: 13px; font-weight: 500; border-radius: 6px;
  border: 1px solid #e2e8f0; cursor: pointer; transition: all 0.15s;
}
.wf-modal__btn--primary { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.wf-modal__btn--primary:hover { background: #4338ca; }
.wf-modal__btn--cancel { background: #fff; color: #64748b; }
.wf-modal__btn--cancel:hover { background: #f1f5f9; }

/* ── Workflow create landing page ─────────────────────── */
.wf-create { max-width: 560px; margin: 60px auto 40px; padding: 0 20px; }
.wf-create__hero { text-align: center; margin-bottom: 28px; }
.wf-create__hero-icon { display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 20px; background: #f1f5f9; }
.wf-create__ai { margin-bottom: 20px; }
.wf-create__ai-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 8px 10px 8px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wf-create__ai-input-wrap:focus-within { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.wf-create__ai-input-wrap.is-loading { opacity: 0.6; pointer-events: none; }
.wf-create__ai-icon { color: #6366f1; flex-shrink: 0; }
.wf-create__ai-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; color: #0f172a; padding: 6px 0;
}
.wf-create__ai-input::placeholder { color: #94a3b8; }
.wf-create__ai-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: #6366f1; color: #fff; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.wf-create__ai-btn:hover { background: #4f46e5; }
.wf-create__ai-btn:disabled { background: #a5b4fc; cursor: default; }
.wf-create__ai-status {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  margin-top: 10px; font-size: 13px; color: #6366f1;
}
.wf-create__ai-status.is-hidden { display: none; }

.wf-create__divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: #94a3b8; font-size: 13px;
}
.wf-create__divider::before, .wf-create__divider::after {
  content: ""; flex: 1; height: 1px; background: #e2e8f0;
}

.wf-create__options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wf-create__card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 24px 16px; border: 1px solid #e2e8f0; border-radius: 12px;
  background: #fff; text-decoration: none; color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wf-create__card:hover { border-color: #6366f1; box-shadow: 0 2px 8px rgba(99,102,241,.1); }
.wf-create__card-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px;
  background: #f1f5f9; color: #6366f1; margin-bottom: 12px;
}
.wf-create__card h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; color: #0f172a; }
.wf-create__card p { font-size: 12px; color: #64748b; margin: 0; line-height: 1.4; }

/* ── Workflow template library ────────────────────────── */
.wf-tpl { max-width: 960px; margin: 0 auto; padding: 32px 20px; }
.wf-tpl__header { margin-bottom: 24px; }
.wf-tpl__header h2 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.wf-tpl__header p { font-size: 13px; color: #64748b; margin: 0; }

.wf-tpl__filters { display: flex; gap: 10px; margin-bottom: 20px; }
.wf-tpl__search {
  flex: 1; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 13px; outline: none; background: #fff;
}
.wf-tpl__search:focus { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,.1); }
.wf-tpl__cat-select {
  padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 13px; background: #fff; cursor: pointer;
}

.wf-tpl__count { font-size: 12px; color: #94a3b8; margin-bottom: 14px; }
.wf-tpl__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.wf-tpl__card {
  display: flex; flex-direction: column; padding: 18px; border: 1px solid #e2e8f0;
  border-radius: 10px; background: #fff; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s; text-decoration: none; color: inherit;
}
.wf-tpl__card:hover { border-color: #6366f1; box-shadow: 0 2px 8px rgba(99,102,241,.1); }
.wf-tpl__card-name { font-size: 14px; font-weight: 600; margin: 0 0 4px; color: #0f172a; }
.wf-tpl__card-desc { font-size: 12px; color: #64748b; margin: 0 0 12px; line-height: 1.5; flex: 1; }
.wf-tpl__card-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wf-tpl__tag {
  display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px;
  border-radius: 4px; background: #f1f5f9; color: #475569;
}
.wf-tpl__card--empty { grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: #94a3b8; font-size: 13px; }

/* ── Template preview modal ──────────────────────────── */
.tpl-preview-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.tpl-preview-overlay.is-active { opacity: 1; pointer-events: auto; }

.tpl-preview-modal {
  background: #fff; border-radius: 14px;
  width: 90vw; max-width: 860px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.2), 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(12px); transition: transform .2s ease;
}
.tpl-preview-overlay.is-active .tpl-preview-modal { transform: translateY(0); }

.tpl-preview-modal__header {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px 24px 16px; border-bottom: 1px solid #f1f5f9;
}
.tpl-preview-modal__info { flex: 1; min-width: 0; }
.tpl-preview-modal__title { font-size: 18px; font-weight: 700; color: #1e293b; margin: 0 0 4px; }
.tpl-preview-modal__desc { font-size: 13px; color: #64748b; margin: 0; line-height: 1.5; }
.tpl-preview-modal__close {
  flex-shrink: 0; width: 32px; height: 32px;
  border: none; background: #f1f5f9; border-radius: 8px;
  font-size: 20px; color: #64748b; cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s;
}
.tpl-preview-modal__close:hover { background: #e2e8f0; color: #334155; }

.tpl-preview-modal__canvas {
  flex: 1; overflow: auto;
  background:
    radial-gradient(circle, #d4d8dd 0.8px, transparent 0.8px);
  background-size: 20px 20px;
  background-color: #f8fafc;
  min-height: 280px;
}
.tpl-preview-graph {
  display: flex; flex-direction: column; align-items: center;
  padding: 36px 24px 60px;
  min-height: 100%; min-width: fit-content;
}
.tpl-preview-zone { padding: 0; margin: 0; }
.tpl-preview-zone .fl-add-row { display: none; }
.tpl-preview-zone .fl-delete { display: none; }
.tpl-preview-card { cursor: default !important; pointer-events: none; }
.tpl-preview-modal__empty { text-align: center; padding: 60px 20px; color: #94a3b8; font-size: 13px; }

.tpl-preview-modal__footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 24px; border-top: 1px solid #f1f5f9;
}

/* ── Bulk edit modal ────────────────────────────────── */
.bulk-edit-table {
  width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px;
}
.bulk-edit-table thead th {
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted, #64748b); padding: 6px 8px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.bulk-edit-th-check { width: 28px; }
.bulk-edit-th-field { width: 35%; }
.bulk-edit-th-value { }
.bulk-edit-row td { padding: 8px 8px; border-bottom: 1px solid var(--line, #f1f5f9); vertical-align: middle; }
.bulk-edit-row:last-child td { border-bottom: none; }
.bulk-edit-td-check { width: 28px; text-align: center; }
.bulk-edit-td-check input[type="checkbox"] { margin: 0; cursor: pointer; }
.bulk-edit-td-field { font-weight: 500; color: var(--text, #0f172a); white-space: nowrap; }
.bulk-edit-td-field label { cursor: pointer; display: block; }
.bulk-edit-td-value { }
.bulk-edit-input { width: 100%; }
.bulk-edit-placeholder { color: var(--text-muted, #cbd5e1); font-size: 13px; }
.bulk-edit-hint { display: block; font-size: 11px; color: var(--text-muted, #94a3b8); margin-top: 2px; }
.bulk-edit-section-row td {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
  color: var(--text-muted, #64748b); padding: 12px 8px 6px; border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--surface, #f8fafc);
}

/* ── PO bulk line item actions ─────────────────────── */
.po-bulk-actions-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.po-bulk-actions-bar .btn-sm {
  padding: 4px 10px; font-size: 12px; border-radius: 8px;
}
.po-bulk-actions-bar .btn-danger-outline {
  color: var(--danger, #ef4444); border-color: var(--danger, #ef4444); background: transparent;
}
.po-bulk-actions-bar .btn-danger-outline:hover {
  background: var(--danger, #ef4444); color: #fff;
}
.bulk-line-item-modal { width: min(680px, 94vw); }
.bulk-line-item-modal .modal-body { max-height: 60vh; overflow-y: auto; }

/* Recommendations bulk qty override follow-up */
.repl-bulk-resolution-fieldset { border: 0; padding: 0; margin: 1rem 0 0; }
.repl-bulk-resolution-fieldset legend { margin-bottom: 0.35rem; }
.repl-bulk-resolution-fieldset .radio-label {
  display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.5rem; line-height: 1.35;
}
.repl-bulk-failed-wrap { margin-top: 1rem; max-height: min(40vh, 320px); overflow: auto; }

.move-target-list {
  display: flex; flex-direction: column; gap: 4px; margin-top: 8px;
}
.move-target-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line, #e2e8f0); border-radius: 10px;
  cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.move-target-option:hover {
  border-color: var(--accent, #6366f1); background: #f8faff;
}
.move-target-option input[type="radio"] { margin: 0; flex-shrink: 0; }
.move-target-option:has(input:checked) {
  border-color: var(--accent, #6366f1); background: #f0f0ff;
}
.move-target-label {
  display: flex; flex-direction: column; gap: 1px; font-size: 13px; line-height: 1.4;
}
.move-target-label strong { font-weight: 600; }
.move-target-divider {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
  color: var(--text-muted, #94a3b8); padding: 10px 0 4px;
}

/* ── Info popover (hover card on icon) ───────────────── */
.info-popover-wrap {
  position: relative; display: inline-flex; align-items: center;
}
.info-popover-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--line, #e2e8f0); background: var(--bg, #fff);
  color: var(--text-muted, #94a3b8); cursor: pointer; transition: all 0.12s;
}
.info-popover-trigger:hover {
  background: var(--surface, #f1f5f9); color: var(--text, #0f172a);
  border-color: #cbd5e1;
}
.info-popover {
  display: none; position: absolute; bottom: calc(100% + 8px); right: -8px;
  z-index: 120; width: 260px;
  background: #fff; border: 1px solid var(--line, #e2e8f0); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 12px 14px;
  font-size: 12px; line-height: 1.5;
}
.info-popover-wrap:hover .info-popover { display: block; }
.info-popover__title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted, #64748b);
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line, #e2e8f0);
}
.info-popover__dl {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 10px;
}
.info-popover__dl dt {
  font-weight: 500; color: var(--text-muted, #64748b); white-space: nowrap;
}
.info-popover__dl dd {
  margin: 0; color: var(--text, #0f172a); font-weight: 500; text-align: right;
}

/* ── Policy meta bar ──────────────────────────────────── */
/* ── Replenishment recommendations page ─────────────── */

/* KPI summary cards */
.repl-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.repl-kpi-card {
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 16px 20px;
  transition: box-shadow 0.15s ease;
}
.repl-kpi-card:hover {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.repl-kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #0f172a);
  line-height: 1.1;
}
.repl-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.repl-kpi-card--danger .repl-kpi-value { color: #dc2626; }
.repl-kpi-card--danger { border-color: #fecaca; background: #ffffff; }
.repl-kpi-meta {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  text-align: right;
  margin-top: -4px;
}
@media (max-width: 768px) {
  .repl-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Replenishment stat bar (compact alternative to kpi cards) ── */
.repl-stat-bar {
  display: flex;
  align-items: center;
  gap: 0;
  /* Bleed to full width while sitting flush below the topbar with a small gap */
  margin: -18px -24px 24px;
  padding: 12px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--line, #e5e7eb);
  border-bottom: 1px solid var(--line, #e5e7eb);
  flex-wrap: wrap;
}

.repl-stat-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-right: 24px;
  margin-right: 24px;
  border-right: 1px solid var(--line, #e5e7eb);
}

.repl-stat-item:last-of-type {
  border-right: none;
}

.repl-stat-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink, #1f2933);
  line-height: 1.15;
}

.repl-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.repl-stat-item--danger .repl-stat-value {
  color: #dc2626;
}

.repl-stat-item--warning .repl-stat-value {
  color: #b45309;
}

.repl-stat-link {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-decoration: none;
  color: inherit;
}

.repl-stat-link:hover .repl-stat-value {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.repl-stat-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  align-self: center;
}

@media (max-width: 640px) {
  .repl-stat-bar { gap: 12px; padding: 10px 16px; margin-left: -16px; margin-right: -16px; }
  .repl-stat-item { border-right: none; padding-right: 0; margin-right: 0; }
  .repl-stat-meta { margin-left: 0; width: 100%; }
}


/* Used by variant, product, vendor show pages (and any future record page). */

/* Break out of .content padding so tabs span full width like the header */
.entity-show {
  margin-top: -24px;
  margin-left: -24px;
  margin-right: -24px;
  width: calc(100% + 48px);
}
/* Override base .tabs row flex — stack everything vertically */
.entity-show__tabs.tabs {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
}
.entity-show__tabs > .tabs__bar {
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}
.entity-show__tabs .tabs__panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  box-sizing: border-box;
  width: 100%;
}
.entity-show__tabs .tabs__panel .panel,
.entity-show__tabs .tabs__panel .panel.table-panel {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* At-a-glance KPI row below tabs — always visible, horizontally padded to match panels */
.entity-show__glance.repl-kpi-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 16px 24px;
  width: 100%;
  box-sizing: border-box;
}
.entity-show__glance .repl-kpi-card { min-width: 0; }
@media (max-width: 900px) {
  .entity-show__glance.repl-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .entity-show__glance.repl-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Overview: 2-column grid for detail panels */
.entity-show__overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.entity-show__overview-grid > .panel { min-width: 0; }
.entity-show__overview-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.entity-show__overview-col > .panel { min-width: 0; }
@media (max-width: 768px) {
  .entity-show__overview-grid { grid-template-columns: 1fr; }
}

/* Metric-cards spanning full available width inside tabs */
.entity-show__tabs .metric-cards {
  margin-bottom: 0;
  grid-template-columns: repeat(3, 1fr);
}

/* ── Variant show page ──────────────────────────────────── */
/* Structural rules inherited from .entity-show above */

/* Variant-specific rules */
.variant-show__block-reason { font-size: 11px; line-height: 1.3; margin-top: 6px; }

/* ── Product show page ──────────────────────────────────── */
/* Structural rules inherited from .entity-show above */

/* Product-specific rules */
.product-show__images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}
.product-show__image-item {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line, #e2e8f0);
  aspect-ratio: 1;
}
.product-show__image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Vendor show page ──────────────────────────────────── */
/* Structural rules inherited from .entity-show above */
.vendor-show__glance.repl-kpi-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .vendor-show__glance.repl-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Header thumbnail */
.variant-topbar-media {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line, #e2e8f0);
  background: var(--panel, #fff);
}
.variant-topbar-media__img { width: 100%; height: 100%; object-fit: cover; }
.variant-topbar-media__placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--muted, #64748b);
  background: var(--soft, #f1f5f9);
}

/* Header title hierarchy: product title large, SKU small */
h1.variant-topbar-title { font-size: 18px; font-weight: 700; line-height: 1.2; margin: 0; }
.variant-topbar-sku { font-size: 13px; margin: 2px 0 0; color: var(--muted, #64748b); }

/* (bulk actions live inside the table selection-bar via selection-bar__actions) */

/* Tab pill count badges */
.tab-pill__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
}
.tab-pill.is-active .tab-pill__count {
  background: rgba(255, 255, 255, 0.2);
}

/* Run meta bar */
.run-meta-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 16px;
  background: var(--bg, #fff); border: 1px solid var(--line, #e2e8f0); border-radius: 8px;
  font-size: 13px;
}
.run-meta-bar__info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.run-meta-bar__label { font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.03em; color: var(--text-muted, #64748b); }
.run-meta-bar__value { color: var(--text, #0f172a); }
.run-meta-bar__sep { color: var(--text-muted, #64748b); }
.run-meta-bar__tabs { display: flex; gap: 4px; }
.tab-pill {
  display: inline-flex; align-items: center; padding: 4px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
  background: transparent; border: 1px solid var(--line, #e2e8f0);
  color: var(--text-muted, #64748b); cursor: pointer; text-decoration: none;
  transition: all 0.15s ease; gap: 2px;
}
.tab-pill:hover { background: var(--bg-hover, #f1f5f9); color: var(--text, #0f172a); }
.tab-pill.is-active {
  background: var(--text, #0f172a); color: #fff; border-color: var(--text, #0f172a);
}

/* ── Facet bar (quick filters, inline in utility bar) ── */
.facet-bar-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.facet-bar-inline::after {
  content: "";
  width: 1px;
  height: 20px;
  background: var(--line, #e2e8f0);
  margin-left: 2px;
}

.facet-dropdown {
  position: relative;
}

.facet-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: var(--bg, #fff);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.facet-trigger:hover {
  border-color: var(--text-muted, #94a3b8);
  color: var(--text, #0f172a);
}
.facet-trigger.is-active {
  border-color: var(--primary, #3b82f6);
  background: #eff6ff;
  color: var(--primary, #3b82f6);
}

.facet-trigger__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.facet-trigger__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary, #3b82f6);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.facet-trigger__badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary, #3b82f6);
}

.facet-trigger__caret {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.15s ease;
}
.facet-dropdown.is-open .facet-trigger__caret {
  transform: rotate(180deg);
}

.facet-trigger__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
  color: var(--primary, #3b82f6);
  cursor: pointer;
  transition: background 0.1s ease;
}
.facet-trigger__clear:hover {
  background: rgba(59, 130, 246, 0.15);
}

.facet-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 220px;
  max-width: 300px;
  background: var(--bg, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1), 0 1px 3px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.facet-dropdown.is-open .facet-menu {
  display: block;
}
.facet-menu--compact {
  min-width: 180px;
}

.facet-menu__search-wrap {
  padding: 8px 8px 4px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.facet-menu__search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
  transition: border-color 0.15s ease;
}
.facet-menu__search:focus {
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.facet-menu__search::placeholder {
  color: var(--text-muted, #94a3b8);
}

.facet-menu__options {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}

.facet-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  color: var(--text, #0f172a);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}
.facet-option:hover {
  background: var(--bg-hover, #f1f5f9);
}

.facet-option__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line, #cbd5e1);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.facet-option__check svg {
  opacity: 0;
  transition: opacity 0.1s ease;
}
.facet-option.is-selected .facet-option__check {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
}
.facet-option.is-selected .facet-option__check svg {
  opacity: 1;
  stroke: #fff;
}

.facet-option__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facet-menu__empty {
  padding: 16px 10px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
}

.facet-clear-all {
  padding: 5px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.facet-clear-all:hover {
  color: var(--text, #0f172a);
  background: var(--bg-hover, #f1f5f9);
}

/* ── Richer product thumbnail ── */
.product-thumb--lg {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.product-thumb__avatar {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

/* ── Clickable rows & hover affordance ── */
.repl-row {
  cursor: pointer;
  position: relative;
  transition: background 0.1s ease;
  outline: none;
}
.repl-row:hover {
  background: #f1f5f9;
}
.repl-row:hover td:first-child {
  box-shadow: inset 3px 0 0 0 var(--accent, #6366f1);
}
.repl-row:focus-visible {
  background: #eef2ff;
}
.repl-row:focus-visible td:first-child {
  box-shadow: inset 3px 0 0 0 #6366f1;
}

/* ── Numeric column alignment ── */
.col-numeric { text-align: right; }
th.col-numeric .table-sort { justify-content: flex-end; }

/* ── Select column ── */
.col-select { width: 36px; padding-left: 12px !important; padding-right: 4px !important; }

/* ── Item details title ── */
.item-details__title {
  font-weight: 500;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Vendor label ── */
.vendor-label {
  font-size: 13px;
  max-width: 140px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Stock on hand indicator ── */
.stock-indicator { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.stock-indicator__dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.stock-indicator--critical .stock-indicator__dot { background: #dc2626; }
.stock-indicator--low .stock-indicator__dot { background: #f59e0b; }
.stock-indicator--adequate .stock-indicator__dot { background: #22c55e; }
.stock-indicator--high .stock-indicator__dot { background: #16a34a; }

/* ── Stockout cell ── */
.stockout-cell { display: flex; flex-direction: column; gap: 1px; }
.stockout-cell__days { font-weight: 600; font-size: 13px; }
.stockout-cell--critical .stockout-cell__days { color: #dc2626; }
.stockout-cell--danger .stockout-cell__days { color: #dc2626; }
.stockout-cell--warning .stockout-cell__days { color: #d97706; }
.stockout-cell--ok .stockout-cell__days { color: var(--text, #0f172a); }
.stockout-cell__date { font-size: 11px; }

/* ── Small text utility ── */
.text-xs { font-size: 11px; }

/* ── Column header with tooltip ── */
.table-header-plain { display: inline; }
th .help-tooltip-wrap { margin-left: 3px; vertical-align: middle; }
th .help-tooltip-trigger { vertical-align: middle; }

/* ── Sticky header + first columns ── */
.data-table thead { position: sticky; top: 0; z-index: 5; }
.data-table thead th { background: #f8fafc; }
/* Sticky first columns: only apply image/item offsets when a select column exists (see PO line items vs vendor invoice line items). */
.data-table:has(th[data-column-id="select"]) td[data-column-id="select"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="select"],
.data-table:has(th[data-column-id="select"]) td[data-column-id="image"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="image"],
.data-table:has(th[data-column-id="select"]) td[data-column-id="item"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="item"] {
  position: sticky;
  z-index: 3;
  background: #fff;
}
.data-table:has(th[data-column-id="select"]) th[data-column-id="select"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="image"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="item"] {
  background: #f8fafc;
  z-index: 6;
}
.data-table:has(th[data-column-id="select"]) td[data-column-id="select"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="select"] { left: 0; }
.data-table:has(th[data-column-id="select"]) td[data-column-id="image"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="image"] { left: 36px; }
.data-table:has(th[data-column-id="select"]) td[data-column-id="item"],
.data-table:has(th[data-column-id="select"]) th[data-column-id="item"] { left: 80px; }
.repl-row:hover td[data-column-id="select"],
.repl-row:hover td[data-column-id="image"],
.repl-row:hover td[data-column-id="item"] {
  background: #f1f5f9;
}
.data-table td[data-column-id="item"]::after,
.data-table th[data-column-id="item"]::after {
  content: "";
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  width: 6px;
  pointer-events: none;
  background: linear-gradient(to right, rgba(15, 23, 42, 0.04), transparent);
}

.po-line-filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Replenishment view tabs ── */
.repl-view-tabs {
  display: flex;
  gap: 2px;
  margin: 16px 0 0;
  border-bottom: 2px solid var(--line);
}

.repl-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.repl-view-tab:hover {
  color: var(--ink);
  background: var(--soft);
}

.repl-view-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: none;
}

.repl-view-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 0 5px;
  height: 18px;
  font-size: 11px;
  font-weight: 600;
  background: var(--soft);
  color: var(--muted);
  border-radius: 9px;
}

.repl-view-tab.is-active .repl-view-tab__count {
  background: var(--accent-weak);
  color: var(--accent);
}

/* ── Replenishment vendor table ── */
.repl-vendor-table {
  table-layout: auto;
}

.repl-vendor-row {
  cursor: default;
}

.repl-vendor-row:hover td {
  background: #f8fafc;
}

.repl-vendor-name-cell {
  padding-top: 10px;
  padding-bottom: 10px;
}

.repl-vendor-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.font-medium {
  font-weight: 500;
}

.repl-vendor-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.repl-vendor-expand-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.repl-vendor-expand-icon {
  transition: transform 0.15s;
  flex-shrink: 0;
}

.repl-vendor-expand-icon.is-open {
  transform: rotate(180deg);
}

.repl-vendor-expand-label {
  line-height: 1;
}

.repl-vendor-actions {
  text-align: right;
  padding-right: 16px;
}

.repl-vendor-build-form {
  display: inline;
}

.repl-vendor-stockout-risk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #dc2626;
  font-weight: 600;
  font-size: 13px;
}

.repl-vendor-est-cost-cell {
  white-space: nowrap;
}

.repl-vendor-est-cost {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
}

/* Uses shared .help-tooltip-* (fixed positioning) so the tip is not swallowed by .table-wrap overflow-x */
.repl-vendor-cost-warning.help-tooltip-wrap {
  margin-left: 0;
}

.repl-vendor-cost-warning .help-tooltip-trigger {
  cursor: pointer;
  color: #d97706;
  border-radius: 4px;
  text-decoration: none;
}

.repl-vendor-cost-warning .help-tooltip-trigger:visited {
  color: #d97706;
}

.repl-vendor-cost-warning .help-tooltip-trigger:hover,
.repl-vendor-cost-warning .help-tooltip-trigger:focus {
  color: #b45309;
}

.repl-vendor-cost-warning .help-tooltip-trigger svg {
  display: block;
}

/* ── Expanded vendor lines ── */
.repl-vendor-expanded-row > td {
  padding: 0 !important;
  border-top: none;
}

.repl-vendor-expanded-inner {
  background: #f8fafc;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.repl-vendor-lines-table {
  margin: 0;
  background: transparent;
}

.repl-vendor-lines-table thead th {
  background: #f1f5f9;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
}

.repl-vendor-lines-table tbody td {
  padding: 8px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.repl-vendor-lines-table tbody tr:last-child td {
  border-bottom: none;
}

.repl-vendor-line-row {
  cursor: pointer;
}

.repl-vendor-line-row:hover td {
  background: #f0f4ff;
}

.repl-vendor-lines-loading {
  padding: 16px 24px;
  font-size: 13px;
}

.repl-vendor-lines-footer {
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--soft);
}

.item-details--compact .item-details__title {
  font-size: 13px;
  line-height: 1.3;
}

.btn-xs {
  font-size: 11.5px;
  padding: 2px 8px;
  height: 24px;
}

/* Empty state inline variant */
.empty-state--inline {
  padding: 32px 24px;
  text-align: center;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-top: 12px;
}



.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px; text-align: center;
}
.empty-state__icon { margin-bottom: 16px; color: var(--text-muted, #64748b); opacity: 0.5; }
.empty-state h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.empty-state-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.empty-state p { margin: 0 0 20px; }
.empty-state .btn { margin-top: 4px; }
.policy-empty-state .muted { max-width: 440px; margin-left: auto; margin-right: auto; }
.policy-empty-state--hero { text-align: center; padding: 48px 24px; }
.policy-empty-state__title { margin: 0 0 12px; font-size: 24px; font-weight: 600; }
.policy-empty-state__desc { margin: 0 0 24px; color: var(--muted); font-size: 16px; line-height: 1.5; max-width: 480px; margin-left: auto; margin-right: auto; }
.policy-empty-state__cta { margin: 0 0 16px; }
.policy-empty-state__cta .btn-lg { padding: 12px 24px; font-size: 16px; }
.policy-empty-state__sub { margin: 0; font-size: 14px; max-width: 440px; margin-left: auto; margin-right: auto; }

.text-danger { color: #dc2626; }

.policy-meta-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 16px;
  background: var(--bg, #fff); border: 1px solid var(--line, #e2e8f0); border-radius: 8px;
  font-size: 13px;
}
.policy-meta-bar__item {
  display: flex; align-items: center; gap: 6px;
}
.policy-meta-bar__item .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.policy-meta-bar__source { flex: 1; min-width: 0; }
.policy-meta-bar__source .truncate {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; display: inline-block; vertical-align: middle;
}

.policy-show-runs {
  margin-top: 24px;
}

/* Global defaults: category spacing and table typography */
.policy-defaults-panel {
  padding-bottom: 20px;
}
.policy-overrides-filter {
  margin-top: 6px;
  font-size: 14px;
}
.policy-overrides-filter .link {
  margin-left: 8px;
}
.policy-defaults-panel .policy-defaults-category-header {
  padding-left: 16px;
}
.policy-defaults-panel > .table-wrap {
  padding-left: 16px;
}
.policy-defaults-panel .policy-defaults-category-title {
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  font-size: 1.1rem;
}
.policy-defaults-panel .policy-defaults-category-desc {
  margin: 0 0 0.75rem;
  font-size: 13px;
}
.policy-defaults-panel .policy-defaults-category-header:first-of-type .policy-defaults-category-title {
  margin-top: 0.75rem;
}
.policy-defaults-table.data-table-compact th,
.policy-defaults-table.data-table-compact td {
  font-size: 15px;
  padding: 10px 14px;
}
.policy-defaults-table.data-table-compact th {
  font-size: 12px;
}
.policy-defaults-table .policy-defaults-desc {
  font-size: 13px;
  margin-top: 2px;
}
.policy-defaults-panel .policy-defaults-subgroups {
  padding-left: 16px;
  padding-right: 16px;
  margin-top: 4px;
}
.policy-defaults-subgroup-details {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 6px);
  margin-bottom: 8px;
  overflow: hidden;
}
.policy-defaults-subgroup-details:last-child {
  margin-bottom: 0;
}
.policy-defaults-subgroup-summary {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--soft, #f8fafc);
  user-select: none;
}
.policy-defaults-subgroup-summary-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.policy-defaults-subgroup-summary .policy-defaults-subgroup-title {
  color: inherit;
}
.policy-defaults-subgroup-summary .policy-defaults-subgroup-desc {
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--muted, #64748b);
  opacity: 0.9;
}
.policy-defaults-subgroup-summary::-webkit-details-marker,
.policy-defaults-subgroup-summary::marker {
  display: none;
}
.policy-defaults-subgroup-summary::before {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.policy-defaults-subgroup-details[open] .policy-defaults-subgroup-summary::before {
  transform: rotate(90deg);
}
.policy-defaults-subgroup-summary:hover {
  background: #f1f5f9;
  color: #475569;
}
.policy-defaults-subgroup-summary:hover .policy-defaults-subgroup-desc {
  color: #64748b;
}
.policy-defaults-subgroup-details .table-wrap {
  padding: 0;
}
.policy-defaults-subgroup-details .policy-defaults-table {
  margin: 0;
}
.policy-defaults-subgroup-details .policy-defaults-table thead th {
  border-top: none;
}
.policy-defaults-value-inline {
  margin-right: 8px;
}
.policy-default-save--hidden {
  display: none;
}

/* ── Reusable tabs (horizontal bar + panels) ───────────────────── */
.tabs {
  margin-bottom: 0;
}
.tabs__bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 0;
  background: var(--panel);
  padding: 0 4px 0 0;
  min-height: 44px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.tabs__tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  font-family: inherit;
}
.tabs__tab:hover {
  color: var(--ink);
  background: var(--soft);
}
.tabs__tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--soft);
}
.tabs__tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tabs__panel {
  padding-top: 20px;
}
.tabs__panel[hidden] {
  display: none !important;
}
.tabs__meta {
  margin-top: 16px;
  margin-bottom: 4px;
}
.tabs__meta .policy-impact-bar {
  margin-top: 12px;
}

.policy-impact-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--soft);
  border-radius: var(--radius);
  font-size: 14px;
}
.policy-impact-bar__label {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 11px;
}
.policy-impact-bar__item { margin: 0; }
.policy-impact-bar__link { margin-left: auto; font-weight: 500; }
.policy-simulate-cta {
  padding: 16px 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--accent-weak) 0%, #f5f3ff 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.policy-simulate-cta__text {
  margin: 0 0 12px;
  font-size: 14px;
}
.policy-no-rules-empty--hero {
  text-align: center;
  padding: 32px 24px;
}
.policy-no-rules-empty__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}
.policy-no-rules-empty__desc { margin: 0 0 12px; font-size: 14px; }
.policy-no-rules-empty__examples {
  margin: 0 0 20px;
  padding-left: 24px;
  text-align: left;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.policy-no-rules-empty__examples li { margin-bottom: 8px; }
.policy-no-rules-empty__or { margin-top: 16px; font-size: 13px; }
.policy-rules-intro {
  margin: 4px 0 0;
  font-size: 13px;
  max-width: 560px;
}
.policy-simulate-prompt { }
.policy-runs-explainer { }
.simulate-dialog-intro {
  margin: -4px 0 12px;
  font-size: 13px;
}
.policy-no-rules-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

/* New policy: template cards */
.policy-new-templates {
  margin-bottom: 24px;
}
.policy-new-templates-heading {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}
.policy-new-templates-sub {
  margin: 0 0 16px;
  font-size: 13px;
}
.policy-new-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.policy-template-card {
  padding: 16px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 10px);
  background: var(--panel, #fff);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.policy-template-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.policy-template-card__desc {
  margin: 0;
  font-size: 13px;
  flex: 1;
}
.policy-template-card__preview {
  margin: 6px 0 10px;
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}
.policy-new-divider {
  text-align: center;
  margin: 24px 0 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line, #e2e8f0);
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.policy-new-divider .muted { font-size: 13px; }

/* Pilot Dates landing page */
.pilot-dates-landing {
  padding: 4px 0;
}
.pilot-dates-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.pilot-dates-card {
  display: block;
  padding: 20px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius, 10px);
  background: var(--panel, #fff);
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
  color: inherit;
}
.pilot-dates-card:hover {
  border-color: var(--accent, #3b82f6);
  background: var(--surface, #f8fafc);
}
.pilot-dates-card__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.pilot-dates-card__desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
}
.pilot-dates-card__link {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent, #3b82f6);
}
.pilot-dates-other {
  padding-top: 20px;
  border-top: 1px solid var(--line, #e2e8f0);
}
.pilot-dates-other__title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}
.pilot-dates-other__desc {
  margin: 0 0 12px;
  font-size: 13px;
}
.pilot-dates-other__list {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.6;
}
.pilot-dates-other__list li {
  margin-bottom: 10px;
}
.pilot-dates-other__list li:last-child {
  margin-bottom: 0;
}

/* Pilot overview (home) */
.pilot-overview {
  max-width: 100%;
}
.pilot-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.pilot-overview-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.pilot-overview-card__title {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.pilot-overview-card__name {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}
.pilot-overview-card__value {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
}
.pilot-overview-card__meta {
  margin: 0 0 12px;
  font-size: 13px;
}
.pilot-overview-card__meta:last-of-type {
  margin-bottom: 0;
}
.pilot-overview-card > .btn,
.pilot-overview-card > .btn-sm,
.pilot-overview-card > form,
.pilot-overview-card > .pilot-overview-card__actions {
  margin-top: auto;
  padding-top: 12px;
}
.pilot-overview-card > .btn,
.pilot-overview-card > .btn-sm {
  align-self: flex-start;
}
.pilot-overview-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pilot-overview-cta {
  background: var(--accent-weak);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.pilot-overview-cta__text {
  margin: 0 0 12px;
  font-size: 14px;
}
.pilot-overview-empty {
  text-align: center;
  padding: 48px 24px;
  max-width: 560px;
  margin: 0 auto 32px;
}
.pilot-overview-empty__title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 600;
}
.pilot-overview-empty__desc {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}
.pilot-overview-empty__actions .btn {
  margin-bottom: 4px;
}

.pilot-overview .table-panel .table-wrap {
  margin-bottom: 0;
}
.pilot-overview-view-all {
  margin: 6px 0 0;
  padding: 0;
  font-size: 14px;
}

.th-with-help {
  cursor: help;
  border-bottom: 1px dotted var(--text-muted, #94a3b8);
}

/* ── Reusable help tooltip (question mark / info icon with hover) ── */
.help-tooltip-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
}
.help-tooltip-trigger {
  appearance: none;
  background: none;
  border: none;
  cursor: help;
  padding: 2px;
  color: var(--muted, #6b7280);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.help-tooltip-trigger:hover,
.help-tooltip-trigger:focus {
  color: var(--accent, #2563eb);
  outline: none;
}
.help-tooltip-icon {
  display: block;
}
.help-tooltip-content {
  position: fixed;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  max-width: 320px;
  min-width: 180px;
  width: max-content;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  background: var(--ink, #1f2933);
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  white-space: normal;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.help-tooltip-content.is-visible {
  visibility: visible;
  opacity: 1;
  /* Above fixed overlays (e.g. rule picker dropdown at 99999) when tooltip is portaled to body */
  z-index: 200000;
}
.help-tooltip-divider {
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 5px 0 4px;
}

/* Quantiles under projected sales (P10/P50/P90 on own lines, muted) */
.projected-quantiles {
  font-size: 11px;
  color: var(--muted, #6b7280);
  margin-top: 4px;
  line-height: 1.5;
}
.projected-quantiles div {
  margin: 0;
}

.scope-filters-label {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-right: 6px;
  align-self: center;
}

/* ── Policy sidebar (Sidekick-style chat) ────────────── */
.policy-sidebar {
  position: fixed; top: 48px; right: 0; bottom: 0; width: 380px;
  background: #fff;
  border-left: 1px solid var(--line, #e2e8f0);
  border-top-left-radius: 12px;
  display: flex; flex-direction: column;
  z-index: 90;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.policy-sidebar--open { transform: translateX(0); }

/* Push main content over when sidebar is open */
.main { transition: margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.main.policy-sidebar-push { margin-right: 380px; }

.policy-sidebar__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
}
.policy-sidebar__title {
  font-size: 14px; font-weight: 600; color: var(--text, #0f172a);
  display: flex; align-items: center; gap: 6px;
}
.policy-sidebar__icon {
  font-size: 16px; color: var(--accent, #3b82f6);
}
.policy-sidebar__close {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: none; background: none; border-radius: 6px; cursor: pointer;
  color: var(--text-muted, #64748b); font-size: 15px; transition: background 0.15s;
}
.policy-sidebar__close:hover { background: var(--surface, #f1f5f9); }

.policy-sidebar__messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  background: #fff;
}

.policy-sidebar__input {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--line, #e2e8f0); flex-shrink: 0;
  background: #fff;
}
.policy-sidebar__input .input { flex: 1; min-width: 0; }
.policy-sidebar__input .btn {
  width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0;
}

/* Chat message styles (used inside sidebar) */
.policy-chat-message { display: flex; flex-direction: column; gap: 2px; }
.policy-chat-message--user { align-items: flex-end; }
.policy-chat-message--assistant { align-items: flex-start; }
.policy-chat-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8); padding: 0 4px;
}
.policy-chat-bubble {
  max-width: 92%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.55;
}
.policy-chat-message--user .policy-chat-bubble {
  background: var(--accent, #3b82f6); color: #fff; border-bottom-right-radius: 3px;
}
.policy-chat-message--assistant .policy-chat-bubble {
  background: var(--surface, #f1f5f9); color: var(--text, #0f172a); border-bottom-left-radius: 3px;
}
/* Rich text inside chat bubbles */
.policy-chat-bubble p { margin: 0 0 6px; }
.policy-chat-bubble p:last-child { margin-bottom: 0; }
.policy-chat-bubble strong { font-weight: 600; }
.policy-chat-bubble em { font-style: italic; }
.policy-chat-bubble ol, .policy-chat-bubble ul {
  margin: 6px 0; padding-left: 18px; font-size: 13px;
}
.policy-chat-bubble ol { list-style: decimal; }
.policy-chat-bubble ul { list-style: disc; }
.policy-chat-bubble li { margin-bottom: 3px; line-height: 1.5; }
.policy-chat-bubble li:last-child { margin-bottom: 0; }
.policy-chat-bubble code {
  font-family: monospace; font-size: 12px; background: rgba(0,0,0,0.06);
  padding: 1px 4px; border-radius: 3px;
}
.policy-chat-message--user .policy-chat-bubble code {
  background: rgba(255,255,255,0.2);
}
.policy-chat-actions {
  margin: 8px 0 0; padding-left: 16px; font-size: 12px; list-style: disc;
}
.policy-chat-actions li { margin-top: 2px; opacity: 0.85; }
.policy-chat-errors {
  margin: 8px 0 0; padding-left: 16px; font-size: 12px; list-style: disc; color: #ef4444;
}
.policy-chat-loading {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
}
.policy-chat-loading.hidden { display: none; }
.policy-chat-spinner {
  width: 14px; height: 14px; border: 2px solid var(--line, #e2e8f0);
  border-top-color: var(--accent, #3b82f6); border-radius: 50%;
  animation: policy-chat-spin 0.6s linear infinite;
}
@keyframes policy-chat-spin { to { transform: rotate(360deg); } }

/* Active toggle button state */
.btn--active { background: var(--accent, #3b82f6) !important; color: #fff !important; }

/* ── Scope filter pills ──────────────────────────────── */
.scope-filters {
  display: flex; align-items: center; gap: 6px; padding: 10px 16px;
  border-bottom: 1px solid var(--line, #e2e8f0); flex-wrap: wrap;
}
.scope-filter-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line, #e2e8f0);
  background: var(--bg, #fff); color: var(--text-muted, #64748b);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.12s ease;
  white-space: nowrap;
}
.scope-filter-pill:hover { background: var(--surface, #f1f5f9); color: var(--text, #0f172a); }
.scope-filter-pill.is-active {
  background: var(--accent, #3b82f6); color: #fff;
  border-color: var(--accent, #3b82f6);
}
.scope-filter-pill__count {
  font-size: 11px; font-weight: 600; opacity: 0.7;
}

/* Responsive: narrower sidebar on small screens */
@media (max-width: 640px) {
  .policy-sidebar { width: 100%; }
  .main.policy-sidebar-push { margin-right: 0; }
}

/* ── Bundle form ─────────────────────────── */
.variant-search-field {
  position: relative;
}
.search-results-dropdown {
  position: absolute;
  z-index: 100;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e2e4e9);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 2px;
}
.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light, #f0f0f3);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover {
  background: var(--bg-hover, #f6f7f9);
}
.bom-panel { margin-top: 1.5rem; }
.bom-table td { vertical-align: middle; }
.bom-table .input { margin: 0; }
.bom-col-qty { width: 100px; }
.bom-col-wastage { width: 110px; }
.bom-col-actions { width: 80px; text-align: right; }

/* ── Category & condition tags ──────────── */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  white-space: nowrap;
}
.tag--demand { background: #ede9fe; color: #6d28d9; }
.tag--replenishment { background: #dbeafe; color: #1d4ed8; }
.tag--order_constraints { background: #fef3c7; color: #92400e; }
.tag--invoice_approval { background: #e0e7ff; color: #3730a3; }
.tag--flag { background: #fce7f3; color: #9d174d; }
.tag--vendor_threshold { background: #fef3c7; color: #92400e; } /* legacy, kept for existing data until migration */
.tag--condition { background: #f0fdf4; color: #166534; }
.tag--success { background: #dcfce7; color: #166534; }
.tag--warning { background: #fef3c7; color: #92400e; }
.tag--danger  { background: #fee2e2; color: #991b1b; }
.tag--info    { background: #dbeafe; color: #1e40af; }
.tag--light   { background: var(--soft); color: var(--muted); }
.scope-filter-pill--secondary {
  font-size: 11px; padding: 3px 10px;
  border-color: var(--line-light, #f1f5f9);
}

/* ── Condition builder rows ──────────────── */
.condition-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-light, #f1f5f9);
}
.condition-row:last-child { border-bottom: none; }
.condition-remove { flex-shrink: 0; }
.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr auto;
}

/* ── Blackout picker chips ──────────────── */
.blackout-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.blackout-chip {
  cursor: pointer;
  user-select: none;
}
.blackout-chip input[type="checkbox"] {
  display: none;
}
.blackout-chip__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 6px 12px;
  border: 1.5px solid var(--line, #e2e8f0);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-light, #64748b);
  background: var(--surface, #fff);
  transition: all 0.15s ease;
}
.blackout-chip input:checked + .blackout-chip__label {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
  font-weight: 600;
}
.blackout-chip:hover .blackout-chip__label {
  border-color: #94a3b8;
}
.blackout-chip input:checked + .blackout-chip__label:hover {
  border-color: #f87171;
}

/* Sortable table header links */
.th-sort-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.th-sort-link:hover {
  color: var(--link);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════
   ONBOARDING WIZARD
   ═══════════════════════════════════════════════════════════════ */

body.pp-body.onboarding-body {
  background: #f6f7f9;
  padding: 0;
}

/* ─── Shell layout ─────────────────────────────────────────── */

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

/* ─── Left sidebar ─────────────────────────────────────────── */

.ob-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  z-index: 10;
}

.ob-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
}
.ob-logo-mark {
  height: 36px;
  width: auto;
}

/* ─── Step navigation ──────────────────────────────────────── */

.ob-steps {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.ob-step:hover {
  background: var(--soft);
}
.ob-step.is-active {
  background: var(--accent-weak);
}

/* Connecting line between steps */
.ob-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 26px;
  top: 40px;
  width: 2px;
  height: calc(100% - 14px);
  background: var(--line);
  border-radius: 1px;
}
.ob-step.is-completed:not(:last-child)::after {
  background: var(--accent);
}

.ob-step-indicator {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border: 2px solid var(--line);
  color: var(--muted);
  background: #fff;
  transition: all 0.2s;
}
.ob-step.is-active .ob-step-indicator {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.ob-step.is-completed .ob-step-indicator {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.ob-step-number {
  line-height: 1;
}
.ob-step.is-completed .ob-step-number {
  display: none;
}
.ob-step-check {
  width: 16px;
  height: 16px;
  display: none;
}
.ob-step.is-completed .ob-step-check {
  display: block;
}

.ob-step-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-top: 2px;
}
.ob-step-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.ob-step.is-upcoming .ob-step-label {
  color: var(--muted);
}
.ob-step-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.3;
}

/* ─── Progress bar ─────────────────────────────────────────── */

.ob-sidebar-progress {
  padding-top: 20px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
.ob-progress-bar {
  height: 6px;
  background: var(--soft);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.ob-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.ob-progress-label {
  font-size: 11.5px;
  color: var(--muted);
}

/* ─── Main content area ────────────────────────────────────── */

.ob-main {
  flex: 1;
  margin-left: 300px;
  position: relative;
}

.ob-panel {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}
.ob-panel.is-active {
  display: flex;
}

.ob-panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 48px 48px 120px;
}

.ob-panel-content {
  margin: 0 auto;
}
.ob-panel-narrow {
  max-width: 580px;
}
.ob-panel-wide {
  max-width: 760px;
}
.ob-panel-centered {
  text-align: center;
}
.ob-panel-centered .ob-subtitle {
  margin-left: auto;
  margin-right: auto;
}

/* ─── Footer (prev/next) ──────────────────────────────────── */

.ob-footer {
  position: fixed;
  bottom: 0;
  left: 300px;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 16px 48px;
  z-index: 5;
}
.ob-footer-inner {
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ─── Typography ───────────────────────────────────────────── */

.ob-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 8px;
}
.ob-subtitle {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 32px;
  max-width: 540px;
}

/* ─── Greeting (step 1) ───────────────────────────────────── */

.ob-greeting {
  text-align: center;
  margin-bottom: 36px;
}
.ob-greeting .ob-subtitle {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.ob-greeting-wave {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

/* ─── Cards ────────────────────────────────────────────────── */

.ob-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.ob-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.ob-card-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--accent);
}
.ob-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.ob-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ─── Form fields ──────────────────────────────────────────── */

.ob-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 18px;
}
.ob-field:last-child {
  margin-bottom: 0;
}
.ob-field-grow {
  flex: 1;
}

.ob-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.ob-input {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s;
  outline: none;
}
.ob-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.ob-input-narrow {
  width: 120px;
}
.ob-input-tiny {
  width: 72px;
  text-align: center;
}

.ob-input-group {
  display: flex;
  align-items: center;
}
.ob-input-group .ob-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
.ob-input-suffix {
  font-size: 13px;
  color: var(--muted);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--soft);
  white-space: nowrap;
}

.ob-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.ob-field-remove {
  display: flex;
  align-items: center;
  padding-bottom: 0;
  margin-bottom: 18px;
  height: 38px;
}

.ob-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

/* ─── Choice cards (radio selectors) ───────────────────────── */

.ob-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ob-choice input {
  display: none;
}
.ob-choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.ob-choice-card:hover {
  border-color: #cbd5e1;
  background: var(--soft);
}
.ob-choice input:checked + .ob-choice-card {
  border-color: var(--accent);
  background: var(--accent-weak);
}
.ob-choice-icon {
  width: 28px;
  height: 28px;
  color: var(--muted);
}
.ob-choice input:checked + .ob-choice-card .ob-choice-icon {
  color: var(--accent);
}
.ob-choice-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.ob-choice-hint {
  font-size: 11.5px;
  color: var(--muted);
}

/* ─── Connect store options ────────────────────────────────── */

.ob-connect-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ob-connect-option input {
  display: none;
}

.ob-connect-card {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.15s;
}
.ob-connect-card:hover {
  border-color: #cbd5e1;
}
.ob-connect-option input:checked + .ob-connect-card {
  border-color: var(--accent);
  background: #fafbff;
}

.ob-connect-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ob-connect-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ob-connect-logo svg {
  width: 24px;
  height: 24px;
}
.ob-connect-logo-shopify {
  background: #e8f5e9;
  color: #5c8a3e;
}
.ob-connect-logo-csv {
  background: #e3f2fd;
  color: var(--accent);
}
.ob-connect-logo-manual {
  background: var(--soft);
  color: var(--muted);
}

.ob-connect-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.ob-connect-card-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.ob-connect-card-detail {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ob-connect-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.ob-badge {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.ob-btn-shopify {
  background: #5c8a3e;
  color: #fff;
  border-color: #4a7032;
}
.ob-btn-shopify:hover {
  background: #4a7032;
}

/* ─── Upload zone ──────────────────────────────────────────── */

.ob-upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.ob-upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}
.ob-upload-icon {
  width: 32px;
  height: 32px;
  color: var(--muted);
  margin: 0 auto 8px;
  display: block;
}
.ob-upload-text {
  font-size: 13.5px;
  color: var(--ink);
  display: block;
}
.ob-upload-text strong {
  color: var(--accent);
  cursor: pointer;
}
.ob-upload-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}

/* ─── Buttons ──────────────────────────────────────────────── */

.ob-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.3;
}
.ob-btn:hover {
  background: var(--soft);
}

.ob-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ob-btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.ob-btn-lg {
  padding: 13px 28px;
  font-size: 15px;
}

.ob-btn-ghost {
  background: none;
  border-color: transparent;
  color: var(--muted);
}
.ob-btn-ghost:hover {
  background: var(--soft);
  color: var(--ink);
}

.ob-btn-compact {
  padding: 7px 14px;
  font-size: 13px;
  margin-top: 12px;
}

.ob-btn-arrow, .ob-btn-arrow-left {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.ob-btn-icon-left {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ob-link {
  color: var(--accent);
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.ob-link:hover {
  color: #1d4ed8;
}

/* ─── Mode toggle ──────────────────────────────────────────── */

.ob-mode-toggle {
  display: flex;
  gap: 4px;
  background: #e2e6ec;
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  width: fit-content;
}
.ob-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: none;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s;
}
.ob-mode-btn:hover {
  color: var(--ink);
}
.ob-mode-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.04);
}

/* ─── Map from Shopify vendor source ───────────────────────── */

.ob-shopify-vendor-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.ob-shopify-vendor-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin: 0 0 2px;
}
.ob-shopify-vendor-desc {
  font-size: 12.5px;
  line-height: 1.45;
  margin: 0;
}
.ob-vendor-intro {
  margin: 0 0 1.25rem;
  font-size: 13px;
  line-height: 1.5;
  max-width: 520px;
}
.ob-vendor-source-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 1rem;
}
@media (max-width: 520px) {
  .ob-vendor-source-cards { grid-template-columns: 1fr; }
}
.ob-vendor-source-card {
  cursor: pointer;
  margin: 0;
}
.ob-vendor-source-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ob-vendor-source-card-inner {
  display: block;
  padding: 1rem 1.1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ob-vendor-source-card:hover .ob-vendor-source-card-inner {
  border-color: var(--muted);
}
.ob-vendor-source-card input:checked + .ob-vendor-source-card-inner {
  border-color: var(--accent);
  background: #f0f4ff;
  box-shadow: 0 0 0 1px var(--accent);
}
.ob-vendor-source-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--soft);
  margin-bottom: 8px;
  color: var(--muted);
}
.ob-vendor-source-card input:checked + .ob-vendor-source-card-inner .ob-vendor-source-card-icon {
  background: var(--accent-weak);
  color: var(--accent);
}
.ob-vendor-source-card-title {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 4px;
}
.ob-vendor-source-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.ob-vendor-source-config {
  margin-top: 0.5rem;
  padding: 1.25rem;
  background: var(--soft);
  border-radius: var(--radius);
}
.ob-vendor-source-config .ob-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 13px;
  font-weight: 600;
}
.ob-vendor-hint {
  margin: 0 0 0.75rem;
  font-size: 12px;
  line-height: 1.45;
}
.ob-vendor-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.ob-vendor-segmented {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}
.ob-vendor-segmented-option {
  margin: 0;
  cursor: pointer;
  font-size: 13px;
}
.ob-vendor-segmented-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ob-vendor-segmented-option span {
  display: block;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  font-weight: 500;
}
.ob-vendor-segmented-option input:checked + span {
  background: var(--accent);
  color: #fff;
}
.ob-vendor-tag-value-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}
.ob-vendor-tag-value {
  width: 100%;
}
.ob-vendor-tag-example-wrap {
  margin-top: 1rem;
}
.ob-vendor-tag-example-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.ob-vendor-tag-example-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.ob-vendor-tag-example-flow {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ob-tag-pill {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-weak);
  border-radius: 4px;
  font-size: 12px;
  font-family: "SF Mono", "Fira Code", monospace;
  color: var(--accent);
}

/* ─── Manual vendor rows ───────────────────────────────────── */

.ob-manual-vendors {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.ob-manual-vendor-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.ob-manual-vendor-row:first-child {
  padding-top: 0;
}
.ob-manual-vendor-row:last-child {
  border-bottom: none;
}
.ob-remove-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.ob-remove-row-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ─── AI-assisted sections ─────────────────────────────────── */

.ob-ai-spark {
  color: #7c3aed;
  font-size: 14px;
}
.ob-ai-spark-lg {
  font-size: 24px;
  color: #7c3aed;
}

.ob-ai-card {
  background: #fff;
  border: 1px solid #e0d4f5;
  border-radius: var(--radius);
  padding: 24px;
}

.ob-ai-header {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}
.ob-ai-header-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}
.ob-ai-header-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.ob-ai-textarea {
  width: 100%;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.ob-ai-textarea::placeholder {
  color: #94a3b8;
}
.ob-ai-textarea:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
  background: #fff;
}

.ob-ai-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.ob-ai-hint {
  font-size: 12px;
  color: var(--muted);
}

.ob-btn-ai {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}
.ob-btn-ai:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}
.ob-btn-ai .ob-ai-spark {
  color: rgba(255,255,255,0.85);
}

/* ─── AI results preview ───────────────────────────────────── */

.ob-ai-results {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.ob-ai-results-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #faf5ff;
  border-bottom: 1px solid #e0d4f5;
  font-size: 13.5px;
  color: var(--ink);
}

.ob-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ob-preview-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.ob-preview-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.ob-preview-table tr:last-child td {
  border-bottom: none;
}

.ob-inline-input {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.ob-inline-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}
.ob-inline-narrow {
  width: 56px;
  text-align: center;
}
.ob-inline-select {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.ob-remove-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ob-remove-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* ─── Strategy quick-prompts ───────────────────────────────── */

.ob-strategy-prompts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.ob-strategy-revise-hint {
  margin-top: 12px;
  font-size: 13px;
}
.ob-strategy-prompts-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.ob-prompt-chip {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #e0d4f5;
  background: #faf5ff;
  color: #7c3aed;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.ob-prompt-chip:hover {
  background: #ede9fe;
  border-color: #7c3aed;
}

/* ─── Policy rules preview ─────────────────────────────────── */

.ob-policy-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}
.ob-policy-rule {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.ob-policy-rule-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.ob-policy-rule-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
}
.ob-policy-rule-badge-replenishment {
  background: #dcfce7;
  color: #166534;
}
.ob-policy-rule-badge-vendor {
  background: #fef3c7;
  color: #92400e;
}
.ob-policy-rule-badge-demand {
  background: #e0e7ff;
  color: #3730a3;
}
.ob-policy-rule-scope {
  font-size: 12.5px;
  color: var(--muted);
  flex: 1;
}
.ob-policy-rule-body {
  padding: 14px;
}
.ob-policy-rule-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.ob-policy-rule-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.ob-policy-rule-unit {
  color: var(--muted);
  font-weight: 400;
}
.ob-policy-rule-row {
  display: flex;
  gap: 32px;
}

/* ─── Toggle switch ────────────────────────────────────────── */

.ob-toggle {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
.ob-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ob-toggle-track {
  width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}
.ob-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.ob-toggle input:checked + .ob-toggle-track {
  background: var(--accent);
}
.ob-toggle input:checked + .ob-toggle-track::after {
  transform: translateX(16px);
}

/* ─── Preferences grid ─────────────────────────────────────── */

.ob-prefs-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ob-pref-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ob-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink);
}
.ob-pref-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ob-pref-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.ob-pref-auto {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

.ob-abc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}
.ob-abc-a {
  background: #dcfce7;
  color: #166534;
}
.ob-abc-b {
  background: #fef3c7;
  color: #92400e;
}
.ob-abc-c {
  background: var(--soft);
  color: var(--muted);
}

/* ─── All-Set step ─────────────────────────────────────────── */

.ob-done {
  margin-bottom: 28px;
}
.ob-done-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.ob-done-icon svg {
  width: 36px;
  height: 36px;
}

.ob-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-bottom: 32px;
}
.ob-summary-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.ob-summary-item-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.ob-summary-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #16a34a;
}
.ob-summary-check svg {
  width: 22px;
  height: 22px;
}
.ob-summary-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.ob-summary-detail {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Next steps grid ──────────────────────────────────────── */

.ob-next-steps {
  text-align: left;
  margin-bottom: 32px;
}
.ob-next-steps-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
}
.ob-next-steps-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ob-next-step-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-decoration: none;
  transition: all 0.15s;
}
.ob-next-step-card:hover {
  border-color: var(--accent);
  background: #fafbff;
}
.ob-next-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-weak);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ob-next-step-icon svg {
  width: 20px;
  height: 20px;
}
.ob-next-step-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ob-next-step-text strong {
  font-size: 13.5px;
  color: var(--ink);
}
.ob-next-step-text span {
  font-size: 12.5px;
  color: var(--muted);
}
.ob-next-step-arrow {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.ob-done-cta {
  margin-top: 8px;
}

/* ─── Skip hint ────────────────────────────────────────────── */

.ob-skip-hint {
  margin-top: 24px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ─── Spinner ──────────────────────────────────────────────── */

.ob-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ob-spin 0.6s linear infinite;
}
@keyframes ob-spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════
   Policy Simulator Modal
   ══════════════════════════════════════════ */

/* Override for hidden attribute when CSS sets explicit display */
.simulate-modal [hidden] { display: none !important; }

.simulate-modal { max-width: 860px; width: 90vw; }
.simulate-modal__content { max-height: 85vh; overflow-y: auto; }

/* ── Variant search ── */
.simulate-search__results {
  max-height: 280px;
  overflow-y: auto;
  margin-top: 8px;
}
.simulate-variant-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--line-light, #f1f5f9);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.1s;
}
.simulate-variant-option:last-child { border-bottom: none; }
.simulate-variant-option:hover { background: var(--surface-hover, #f8fafc); }
.simulate-variant-option__sku {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  min-width: 100px;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.simulate-variant-option__name {
  color: var(--ink-light, #64748b);
  font-size: 13px;
}

/* ── Loading spinner ── */
.simulate-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 12px;
}
.simulate-loading__spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line, #e2e8f0);
  border-top-color: var(--link, #3b82f6);
  border-radius: 50%;
  animation: simulate-spin 0.7s linear infinite;
}
@keyframes simulate-spin { to { transform: rotate(360deg); } }

/* ── Results header ── */
.simulate-results__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.simulate-results__header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 2px;
}

/* ── Summary cards ── */
.simulate-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 700px) {
  .simulate-summary { grid-template-columns: repeat(2, 1fr); }
}
.simulate-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line, #e2e8f0);
  background: var(--surface, #fff);
}
.simulate-card__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-light, #64748b);
  margin-bottom: 4px;
}
.simulate-card__value {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.simulate-card__meta {
  font-size: 12px;
  color: var(--ink-light, #64748b);
  margin-top: 4px;
}

/* ── Sections ── */
.simulate-section {
  margin-bottom: 20px;
  border-top: 1px solid var(--line-light, #f1f5f9);
  padding-top: 16px;
}
.simulate-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px;
}

/* ── Detail table ── */
.simulate-detail-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.simulate-detail-table td {
  padding: 5px 0;
  vertical-align: top;
}
.simulate-detail-table td:first-child {
  width: 180px;
  font-weight: 500;
  padding-right: 12px;
  white-space: nowrap;
}

/* ── Forecast chips ── */
.simulate-forecast-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--surface-hover, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  margin-right: 6px;
  margin-bottom: 4px;
}

/* ── Rules trace ── */
.simulate-rules-group { margin-bottom: 16px; }
.simulate-rules-group__title { margin: 0 0 8px; }
.simulate-rules-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.simulate-rule {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--line-light, #f1f5f9);
  font-size: 13px;
  transition: background 0.1s;
}
.simulate-rule:hover { background: var(--surface-hover, #f8fafc); }
.simulate-rule--default {
  opacity: 0.65;
}
.simulate-rule--active {
  border-left: 3px solid var(--link, #3b82f6);
}
.simulate-rule__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.simulate-rule__name {
  font-weight: 600;
  color: var(--ink);
}
.simulate-rule__value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  font-weight: 600;
}
.simulate-rule__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-light, #64748b);
}
.simulate-rule__candidates {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-light, #f1f5f9);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.simulate-rule__candidate {
  font-size: 11px;
  color: var(--ink-light, #64748b);
  padding: 2px 0;
}
.simulate-rule__candidate--winner {
  color: var(--ink);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   Export CSV modal
   ═══════════════════════════════════════════════════════════════ */

.export-modal {
  width: min(560px, 92vw);
  padding: 0;
  display: flex;
  flex-direction: column;
  height: min(680px, 80vh);
  max-height: 80vh;
  overflow: hidden;
}

/* Ensure the dialog itself doesn't fight the layout */
dialog.modal:has(.export-modal) {
  max-height: 90vh;
  overflow: visible;
}

.export-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 0;
  flex-shrink: 0;
}

.export-modal-header-text h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.export-modal-header-text .muted {
  margin: 2px 0 0;
  font-size: 13px;
}

/* ── Toolbar ── */

.export-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.export-search-wrap {
  flex: 1;
  position: relative;
}

.export-search-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.export-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: var(--panel);
  color: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.export-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}

.export-search-input::placeholder {
  color: var(--muted);
}

.export-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.export-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.12s;
}

.export-link-btn:hover {
  background: var(--accent-weak);
}

.export-toolbar-divider {
  width: 1px;
  height: 16px;
  background: var(--line);
}

/* ── Column body ── */

.export-columns-body {
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
  padding: 4px 0;
}

/* ── Group ── */

.export-group {
  border-bottom: 1px solid var(--line);
}

.export-group:last-child {
  border-bottom: none;
}

.export-group[hidden] {
  display: none;
}

.export-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: inherit;
  transition: background 0.1s;
}

.export-group-header:hover {
  background: #f8fafc;
}

.export-group-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.export-group-name {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.export-group-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.export-chevron {
  transition: transform 0.15s ease;
  flex-shrink: 0;
  color: var(--muted);
}

.export-group--collapsed .export-chevron {
  transform: rotate(-90deg);
}

.export-group--collapsed .export-group-body {
  display: none;
}

/* ── Column items ── */

.export-group-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px 0;
  padding: 0 20px 10px;
}

.export-col-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}

.export-col-label:hover {
  background: #f1f5f9;
}

.export-col-label[hidden] {
  display: none;
}

.export-checkbox {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.export-col-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Footer ── */

.export-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #f9fafb;
  flex-shrink: 0;
}

/* ── State indicators on groups ── */

.export-group--none .export-group-count {
  color: #ef4444;
}

.export-group--all .export-group-count {
  color: var(--accent);
}

/* ── Compact stacked form (used in sidebars) ─────────────────── */

.form-stack-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-stack-compact .form-field {
  margin-bottom: 0;
}
.form-stack-compact .form-label {
  font-size: 12px;
  margin-bottom: 2px;
}
.form-stack-compact .input-compact {
  font-size: 13px;
}

.data-table--compact th,
.data-table--compact td {
  padding: 6px 8px;
  font-size: 12px;
}

.text-xs { font-size: 11px; }
.text-warning { color: #d97706; }

/* ── Auth pages ─────────────────────────────────────────── */
.auth-body {
  margin: 0;
  font-family: "Inter", "SF Pro Text", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  background: #f5f6f8;
  -webkit-font-smoothing: antialiased;
}
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.auth-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 24px rgba(0,0,0,.04);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}
.auth-logo-mark {
  height: 36px;
  width: auto;
}
.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 6px;
  text-align: center;
}
.auth-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 24px;
  text-align: center;
}
.auth-form .form-group {
  margin-bottom: 16px;
}
.auth-form .form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}
.auth-form .form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.auth-form .form-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.auth-form .form-input-code {
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  font-family: monospace;
}
.auth-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.auth-form .form-actions {
  margin-top: 24px;
}
.auth-form .form-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #b91c1c;
}
.auth-form .form-errors p {
  margin: 2px 0;
}
.btn-full {
  width: 100%;
  display: block;
  text-align: center;
}
.auth-links {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
}
.auth-link {
  color: #6366f1;
  text-decoration: none;
}
.auth-link:hover {
  text-decoration: underline;
}
.auth-link-sep {
  color: #d1d5db;
  margin: 0 6px;
}
.auth-link-note {
  color: #6b7280;
}

/* ── Account switcher ─────────────────────────────────── */
.account-switcher {
  position: relative;
}
.account-switcher-pill {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 10px;
  list-style: none;
}
.account-switcher-pill:hover {
  background: #e5e7eb;
}
.account-switcher-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  min-width: 200px;
  z-index: 50;
  padding: 4px;
}
.account-switcher-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  color: #374151;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.account-switcher-item:hover {
  background: #f3f4f6;
}
.account-switcher-item.is-current {
  font-weight: 600;
  color: #6366f1;
}

/* ── User menu enhancements ─────────────────────────── */
.user-menu-name {
  display: block;
  padding: 8px 12px 2px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
}
.user-menu-email {
  display: block;
  padding: 0 12px 8px;
  font-size: 12px;
  color: #6b7280;
}
.user-menu-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 4px 0;
}
.user-menu-item-danger {
  color: #dc2626 !important;
}

/* ── Impersonation banner ─────────────────────────── */
.impersonation-banner {
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.impersonation-stop-btn {
  background: #92400e;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}

/* ── Admin portal ─────────────────────────────────────── */
.admin-body {
  margin: 0;
  font-family: "Inter", "SF Pro Text", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  background: #f0f1f3;
  -webkit-font-smoothing: antialiased;
}
.admin-shell { min-height: 100vh; }
.admin-header {
  background: #1a1a2e;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 52px;
  gap: 32px;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.admin-brand .header-logo-mark { height: 24px; }
.admin-brand-text {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.admin-nav { display: flex; gap: 4px; flex: 1; }
.admin-nav-link {
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
}
.admin-nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.admin-nav-link.is-active { color: #fff; background: rgba(255,255,255,.12); }
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-user-badge {
  background: #6366f1;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.admin-page { }
.admin-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 20px;
}
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-page-header .admin-page-title { margin: 0; }

/* Metrics */
.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.admin-metric-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  text-align: center;
}
.admin-metric-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
}
.admin-metric-label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}
.admin-metric-card-link {
  display: block;
  padding: 20px;
  margin: -20px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}
.admin-metric-card-link:hover {
  background: rgba(0,0,0,.03);
}
.admin-metric-value--small {
  font-size: 16px;
  font-weight: 600;
}

/* Background jobs filters */
.admin-filters {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 24px;
}
.admin-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}
.admin-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-filter-group--actions {
  flex-direction: row;
  align-items: center;
}
.admin-filter-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
.admin-filter-select,
.admin-filter-input {
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  min-width: 180px;
}
.admin-filter-input {
  min-width: 220px;
}
.admin-filter-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}
.admin-filter-details summary {
  cursor: pointer;
  font-size: 13px;
  color: #6b7280;
}

/* Tables */
.admin-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.admin-table-section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 24px;
}
.admin-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 12px;
}
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  padding: 0;
  list-style: none;
}
.admin-tab-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 6px 6px 0 0;
}
.admin-tab-link:hover {
  color: var(--ink);
  background: var(--soft);
}
.admin-tab-link.is-active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.admin-tab-count {
  font-size: 12px;
  opacity: 0.9;
}
.admin-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 400px;
}
.admin-search-form .form-input { flex: 1; min-width: 0; }

/* Admin form controls (inputs, selects, labels) */
.admin-content .form-input,
.admin-content .form-select,
.admin-content input[type="text"],
.admin-content input[type="email"],
.admin-content input[type="password"],
.admin-content input[type="number"] {
  width: 100%;
  max-width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #1a1a2e;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.admin-content .form-input:focus,
.admin-content .form-select:focus,
.admin-content input[type="text"]:focus,
.admin-content input[type="email"]:focus,
.admin-content input[type="password"]:focus,
.admin-content input[type="number"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.admin-content .form-select {
  cursor: pointer;
  appearance: auto;
}
.admin-content .form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}
.admin-content .form-field {
  margin-bottom: 0;
}
.admin-content .form-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}
.admin-content .form-errors {
  padding: 12px 16px;
  margin-bottom: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 13px;
  color: #b91c1c;
}
.admin-content .form-errors p {
  margin: 2px 0;
}
.admin-content .form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.admin-content .form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-content .form-stack .form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Detail cards */
.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.admin-detail-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.admin-detail-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 12px;
}
.admin-dl { margin: 0; }
.admin-dl dt {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}
.admin-dl dd {
  font-size: 13px;
  color: #374151;
  margin: 2px 0 0;
}

/* Pagination */
.admin-pagination {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  justify-content: center;
}
.admin-page-link, .admin-page-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  font-size: 13px;
  border-radius: 6px;
  text-decoration: none;
}
.admin-page-link {
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
}
.admin-page-link:hover { background: #f3f4f6; }
.admin-page-current {
  color: #fff;
  background: #6366f1;
  font-weight: 600;
}

/* Settings extras */
.settings-section {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 20px;
}
.settings-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 16px;
}
.settings-section-description {
  font-size: 13px;
  margin: -8px 0 16px;
}
.invite-member-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}
.invite-member-form .form-field {
  margin: 0;
}
.invite-member-form__email {
  flex: 1;
  min-width: 200px;
}
.invite-member-form__email .input {
  width: 100%;
  min-width: 0;
}
.invite-member-form__role {
  width: 140px;
}
.invite-member-form__role .input {
  width: 100%;
}
.invite-member-form__submit .label {
  visibility: hidden;
}

/* Profile & Security */
.profile-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.profile-form__grid .form-field-wide {
  grid-column: span 2;
}
.profile-form__actions,
.password-form__actions {
  margin-top: 8px;
}
.settings-2fa-block {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.settings-2fa-block .settings-status {
  margin: 0;
}
.settings-2fa-block .btn {
  flex-shrink: 0;
}
@media (max-width: 520px) {
  .profile-form__grid {
    grid-template-columns: 1fr;
  }
  .profile-form__grid .form-field-wide {
    grid-column: span 1;
  }
}
.settings-backup-codes__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
}
.settings-status {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 12px;
}
.settings-status-ok { color: #059669; }
.settings-backup-codes {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}
.backup-codes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.backup-code {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  text-align: center;
}
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.settings-2fa-required-banner {
  background: #fef3c7;
  color: #92400e;
  font-size: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}
/* Switch-style toggle (only when it contains .toggle-slider, e.g. settings/team) */
.toggle:has(.toggle-slider) {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.toggle:has(.toggle-slider) input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 22px;
  cursor: pointer;
  transition: .2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.toggle:has(.toggle-slider) input:checked + .toggle-slider {
  background: #6366f1;
}
.toggle:has(.toggle-slider) input:checked + .toggle-slider::before {
  transform: translateX(18px);
}
.form-inline-row { display: flex; gap: 8px; align-items: flex-end; }
.inline-form { display: inline; }
.role-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.role-type-badge--system {
  background: var(--bg-muted, #f3f4f6);
  color: var(--text-muted, #6b7280);
}
.role-type-badge--custom {
  background: #e0e7ff;
  color: #4338ca;
}
.role-permissions-cell { max-width: 320px; }
.role-permissions-details { margin: 0; }
.role-permissions-summary {
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}
.role-permissions-summary::-webkit-details-marker { display: none; }
.role-permissions-summary::marker { content: ""; }
.role-permissions-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  line-height: 1.5;
}
.role-permissions-list li { margin-bottom: 2px; }

.section-header--with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-header--with-action .settings-section-title { margin-bottom: 4px; }
.section-header--with-action .settings-section-description { margin-bottom: 0; }

.permissions-by-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.permissions-group {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--bg-subtle, #fafafa);
}
.permissions-group__title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.permissions-group__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}
.form-stack--spaced .form-field + .form-field { margin-top: 24px; }

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}
.two-factor-qr {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}
.two-factor-qr svg { width: 200px; height: 200px; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-create { background: #dbeafe; color: #1e40af; }
.badge-update { background: #e0e7ff; color: #3730a3; }
.badge-destroy { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* Audit log */
.audit-change {
  font-size: 12px;
  margin-bottom: 2px;
}
.audit-old {
  color: #dc2626;
  text-decoration: line-through;
}
.audit-new {
  color: #059669;
}

/* Billing */
.billing-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.billing-plan-option {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
}
.billing-plan-option.is-current { border-color: #6366f1; }
.billing-plan-option h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.billing-plan-price { font-size: 24px; font-weight: 700; color: #1a1a2e; }
.billing-plan-price span { font-size: 14px; color: #6b7280; font-weight: 400; }
.billing-plan-card {
  background: #f3f4f6;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.billing-plan-status {
  font-size: 13px;
  font-weight: 600;
}
.status-active { color: #059669; }
.status-trialing { color: #6366f1; }
.status-past_due { color: #d97706; }
.status-canceled { color: #dc2626; }

.billing-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.billing-manage-actions form {
  margin: 0;
  display: inline-block;
}

/* Forecast decision callout */
.forecast-decision-callout {
  margin-top: 0;
}
.forecast-decision-callout p {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
  margin: 0;
}
.forecast-decision-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.forecast-meta-item {
  font-size: 12px;
  color: #6b7280;
}

/* Forecast Intelligence page */
.forecast-accuracy-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.forecast-accuracy-green { color: #059669; }
.forecast-accuracy-amber { color: #d97706; }
.forecast-accuracy-red   { color: #dc2626; }

/* Forecasting metric cards — clearer hierarchy and readability */
.metric-cards--forecasting {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .metric-cards--forecasting {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric-cards--forecasting .metric-card--primary {
    grid-column: 1 / -1;
  }
}
@media (max-width: 520px) {
  .metric-cards--forecasting {
    grid-template-columns: 1fr;
  }
}

.metric-cards--forecasting .metric-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--panel, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  min-width: 0;
}

.metric-cards--forecasting .metric-card--primary {
  background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
  border-color: var(--line, #e2e8f0);
  padding: 22px 24px;
}

.metric-cards--forecasting .metric-card-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #64748b);
  margin: 0;
}

.metric-cards--forecasting .metric-card-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink, #0f172a);
  margin: 0;
  letter-spacing: -0.02em;
}

.metric-cards--forecasting .metric-card--primary .metric-card-value {
  font-size: 26px;
}

.metric-cards--forecasting .metric-card-value-muted {
  font-weight: 500;
  color: var(--muted, #64748b);
  font-size: 0.95em;
}

.metric-cards--forecasting .metric-card-sublabel {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted, #64748b);
  margin: 0;
}

.metric-cards--forecasting .forecast-accuracy-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.metric-cards--forecasting .metric-card--primary .forecast-accuracy-value {
  font-size: 36px;
}

/* Accuracy breakdown — own card below metric row */
.accuracy-breakdown-card {
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--panel, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.accuracy-breakdown-card__header {
  margin-bottom: 14px;
}
.accuracy-breakdown-card__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #0f172a);
}
.accuracy-breakdown-card__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  max-width: 56em;
}
.accuracy-breakdown-card__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}
.accuracy-breakdown-card__segments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.accuracy-breakdown-segment {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--soft, #f8fafc);
  border: 1px solid var(--line, #e5e7eb);
}
.accuracy-breakdown-segment__label {
  font-size: 12px;
  color: var(--muted, #64748b);
}
.accuracy-breakdown-segment__value {
  font-size: 16px;
  font-weight: 700;
}
.accuracy-breakdown-segment__value.forecast-accuracy-green { color: #059669; }
.accuracy-breakdown-segment__value.forecast-accuracy-amber { color: #d97706; }
.accuracy-breakdown-segment__value.forecast-accuracy-red { color: #dc2626; }
.accuracy-breakdown-card__foot {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

/* Forecasting panels — card + single-line filters */
.forecasting-panel {
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line, #e5e7eb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}
.forecasting-panel-header {
  padding: 16px 20px 0;
  margin-bottom: 12px;
}
.forecasting-panel-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink, #0f172a);
}
.forecasting-panel-header .muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  max-width: 56em;
}
.forecasting-filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 12px 20px;
  margin: 0 0 12px;
  background: var(--soft, #f8fafc);
  border-top: 1px solid var(--line, #e5e7eb);
  border-bottom: 1px solid var(--line, #e5e7eb);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 900px) {
  .forecasting-filters {
    flex-wrap: wrap;
  }
}
.forecasting-filters__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.forecasting-filters__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
  margin: 0;
}
.forecasting-filters__input,
.forecasting-filters__select {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  min-width: 0;
  border-radius: 6px;
  border: 1px solid var(--line, #e2e8f0);
  background: #fff;
}
.forecasting-filters__input {
  width: 160px;
}
.forecasting-filters__select {
  min-width: 100px;
  width: 120px;
  max-width: 160px;
  cursor: pointer;
}
.forecasting-filters__submit {
  flex-shrink: 0;
  margin-left: 4px;
}
.forecasting-panel-meta {
  margin: 0 20px 10px;
  font-size: 12px;
}
.forecasting-panel-table-wrap {
  margin: 0 20px 20px;
}
.forecasting-panel-table-wrap .data-table {
  margin: 0;
}
.forecasting-panel-pagination {
  margin: 12px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Method × demand pattern pivot table */
.forecasting-pivot-panel .panel-header {
  margin-bottom: 12px;
}
.forecasting-pivot-wrap {
  min-width: 0;
}
.forecasting-pivot-table {
  margin: 0;
}
.forecasting-pivot-th {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #64748b);
}
.forecasting-pivot-cell {
  padding: 8px 12px;
  font-size: 13px;
}
.forecasting-pivot-total-row {
  border-top: 2px solid var(--line, #e5e7eb);
  background: var(--soft, #f8fafc);
}
.forecasting-pivot-total-row td {
  padding: 10px 12px;
}

/* Topbar forecast status (status + progress left of Run button) */
.toolbar-row--forecasting .topbar-left {
  flex: 0 1 auto;
}
.topbar-forecast-status {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
}
.forecast-header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e5e7eb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  max-width: 100%;
}
.forecast-header-status--complete {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: #a7f3d0;
}
.forecast-header-status--running {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #c7d2fe;
}
.forecast-header-status--error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fca5a5;
}
.forecast-header-status--empty .forecast-header-status-meta {
  font-size: 13px;
}
.forecast-header-status-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #0f172a);
  white-space: nowrap;
}
.forecast-header-status-meta {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted, #64748b);
}
.forecast-header-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.forecast-header-progress-bar {
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.forecast-header-progress-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 0;
}
.forecast-header-progress-text {
  font-size: 12px;
  color: var(--ink, #0f172a);
  white-space: nowrap;
  font-weight: 500;
}
.forecast-header-phase.muted {
  font-size: 11px;
  color: var(--muted, #64748b);
}

/* Demand & replenishment run progress bar (header) */
.demand-replenishment-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  margin: 0 -4px 0 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid #c7d2fe;
  font-size: 12px;
}
.demand-replenishment-progress__bar-wrap {
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.demand-replenishment-progress__fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 4px;
  transition: width 0.35s ease;
  min-width: 0;
}
.demand-replenishment-progress__phase {
  color: var(--muted, #64748b);
  white-space: nowrap;
}

/* Demand & replenishment run progress in main content (flash-style banner) */
.demand-replenishment-banner {
  margin-bottom: 16px;
}
.demand-replenishment-banner__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.demand-replenishment-banner__bar-wrap {
  width: 180px;
  height: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.demand-replenishment-banner__fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 4px;
  transition: width 0.35s ease;
  min-width: 0;
}
.demand-replenishment-banner__text {
  font-weight: 500;
  color: var(--ink, #0f172a);
}
.demand-replenishment-banner__phase.muted {
  font-size: 12px;
  color: var(--muted, #64748b);
}

.forecast-status-banner {
  padding: 12px 20px 20px;
}
.forecast-intelligence-card .panel-header-tight {
  margin-bottom: 0;
}
.forecast-intelligence-card .forecast-status-banner {
  padding-top: 0;
  padding: 0 20px 20px;
}

.forecast-progress-wrap {
  margin-top: 16px;
}
.forecast-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}
.forecast-progress-phase {
  font-weight: 600;
  color: #334155;
}
.forecast-progress-eta {
  color: #6b7280;
  font-size: 12px;
}
.forecast-progress-bar {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}
.forecast-progress-fill {
  height: 100%;
  background: #6366f1;
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 0;
}
.forecast-progress-text {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}

/* ═══════════════════════════════════════════════════
   AI Chatbar — Shopify Sidekick-style panel
   ═══════════════════════════════════════════════════ */

.header-ai-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.header-ai-chat-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.header-ai-chat-btn svg {
  width: 20px;
  height: 20px;
}
.header-ai-chat-btn.is-active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.ai-chatbar {
  position: fixed;
  top: 48px;
  right: 0;
  bottom: 0;
  z-index: 40;
  pointer-events: none;
}

.ai-chatbar-panel {
  position: absolute;
  top: 0;
  right: var(--shell-gutter, 12px);
  bottom: 0;
  width: 380px;
  background: #fff;
  border-left: 1px solid var(--line, #e2e8f0);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + var(--shell-gutter, 12px)));
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  overflow: hidden;
}
.ai-chatbar-panel--open {
  transform: translateX(0);
  pointer-events: auto;
}
.ai-chatbar-panel--expanded {
  width: 700px;
}

body:has(.ai-chatbar-panel--open) .app-shell {
  margin-right: calc(380px + var(--shell-gutter, 12px));
}
body:has(.ai-chatbar-panel--expanded) .app-shell {
  margin-right: calc(700px + var(--shell-gutter, 12px));
}
body:has(.ai-chatbar-panel--open) .header-bar {
  right: calc(380px + var(--shell-gutter, 12px) + var(--shell-gutter, 12px));
}
body:has(.ai-chatbar-panel--expanded) .header-bar {
  right: calc(700px + var(--shell-gutter, 12px) + var(--shell-gutter, 12px));
}

/* ── Header ── */

.ai-chatbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
}
.ai-chatbar-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.ai-chatbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-chatbar-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ai-chatbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: background 0.15s;
}
.ai-chatbar-icon-btn:hover {
  background: var(--surface, #f1f5f9);
  color: var(--text, #0f172a);
}
.ai-chatbar-icon-btn.is-active {
  background: var(--surface, #f1f5f9);
  color: var(--accent, #3b82f6);
}

/* ── History dropdown popup ── */

.ai-chatbar-history-dropdown {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 10;
  display: flex;
  flex-direction: column;
}
.ai-chatbar-history-dropdown.hidden {
  display: none;
}
.ai-chatbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
}
.ai-chatbar-search svg {
  flex-shrink: 0;
  color: var(--text-muted, #64748b);
}
.ai-chatbar-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text, #0f172a);
}
.ai-chatbar-search input::placeholder {
  color: var(--text-muted, #64748b);
}
.ai-chatbar-conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ai-chatbar-conv-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-chatbar-conv-item:hover {
  background: var(--surface, #f1f5f9);
}
.ai-chatbar-conv-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-chatbar-conv-preview {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-chatbar-conv-date {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}
.ai-chatbar-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted, #64748b);
  font-size: 13px;
}

/* ── Chat View ── */

.ai-chatbar-chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Welcome screen ── */

.ai-chatbar-welcome {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.ai-chatbar-welcome.hidden {
  display: none;
}
.ai-chatbar-welcome-icon {
  margin-bottom: 12px;
  color: var(--accent, #3b82f6);
}
.ai-chatbar-welcome h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #0f172a);
  margin: 0 0 20px 0;
}
.ai-chatbar-welcome h3 span:empty { display: none; }

/* ── Skills / Quick Actions ── */

.ai-chatbar-skills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}
.ai-chatbar-skill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, #e2e8f0);
  background: #fff;
  color: var(--text, #0f172a);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.ai-chatbar-skill:hover {
  background: var(--surface, #f1f5f9);
  border-color: var(--accent, #3b82f6);
}
.ai-chatbar-skill-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Messages ── */

.ai-chatbar-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chatbar-msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
}
.ai-chatbar-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ai-chatbar-msg--assistant {
  align-self: flex-start;
}

.ai-chatbar-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  margin-top: 2px;
}

.ai-chatbar-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.ai-chatbar-msg--user .ai-chatbar-msg-bubble {
  background: var(--accent, #3b82f6);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-chatbar-msg--assistant .ai-chatbar-msg-bubble {
  background: var(--surface, #f1f5f9);
  color: var(--text, #0f172a);
  border-bottom-left-radius: 4px;
}
.ai-chatbar-msg-bubble p {
  margin: 0 0 6px 0;
}
.ai-chatbar-msg-bubble p:last-child {
  margin-bottom: 0;
}
.ai-chatbar-msg-bubble ul,
.ai-chatbar-msg-bubble ol {
  margin: 4px 0 6px 0;
  padding-left: 18px;
}
.ai-chatbar-msg-bubble li {
  margin-bottom: 2px;
}
.ai-chatbar-msg-bubble code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}
.ai-chatbar-msg--user .ai-chatbar-msg-bubble code {
  background: rgba(255, 255, 255, 0.2);
}
.ai-chatbar-msg-bubble strong {
  font-weight: 600;
}

/* ── Action pills ── */

.ai-chatbar-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.ai-chatbar-action-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent, #3b82f6);
  font-size: 11px;
  font-weight: 500;
}

.ai-chatbar-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line, #e2e8f0);
  background: transparent;
  color: var(--accent, #3b82f6);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-chatbar-nav-btn:hover {
  background: rgba(37, 99, 235, 0.08);
}

/* ── Entity cards ── */

.ai-chatbar-entity-cards {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.ai-chatbar-entity-card {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
  min-height: 72px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line, #e2e8f0);
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
  overflow: hidden;
}
.ai-chatbar-entity-card:hover {
  border-color: var(--accent, #3b82f6);
  background: #fafbff;
}
.ai-chatbar-entity-card-thumb {
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}
.ai-chatbar-entity-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ai-chatbar-entity-card-thumb .ai-chatbar-entity-card-icon {
  font-size: 22px;
}
.ai-chatbar-entity-card-body {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-chatbar-entity-card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ai-chatbar-entity-card-sku {
  font-size: 11px;
  color: var(--text-muted, #64748b);
}
.ai-chatbar-entity-card-fields {
  width: 100%;
  flex-basis: 100%;
  background: rgba(0, 0, 0, 0.02);
  padding: 8px 12px 10px;
  box-sizing: border-box;
}
.ai-chatbar-entity-card-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.ai-chatbar-entity-card-field:last-child {
  border-bottom: none;
}
.ai-chatbar-entity-card-field-label {
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
}
.ai-chatbar-entity-card-field-value {
  font-weight: 600;
  text-align: right;
  min-width: 0;
}

/* ── Typing indicator ── */

.ai-chatbar-typing {
  padding: 8px 16px;
  display: flex;
  align-items: center;
}
.ai-chatbar-typing.hidden {
  display: none;
}
.ai-chatbar-typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--surface, #f1f5f9);
}
.ai-chatbar-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted, #64748b);
  animation: ai-chatbar-bounce 1.4s ease-in-out infinite;
}
.ai-chatbar-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.ai-chatbar-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes ai-chatbar-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ── Plus menu ── */

.ai-chatbar-plus-menu,
.ai-chatbar-skills-popup,
.ai-chatbar-mention-popup {
  position: absolute;
  bottom: 100%;
  left: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  z-index: 5;
  padding: 6px 0;
  margin-bottom: 4px;
}
.ai-chatbar-plus-menu.hidden,
.ai-chatbar-skills-popup.hidden,
.ai-chatbar-mention-popup.hidden {
  display: none;
}

.ai-chatbar-plus-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #0f172a);
  text-align: left;
  transition: background 0.15s;
}
.ai-chatbar-plus-menu-item:hover {
  background: var(--surface, #f1f5f9);
}
.ai-chatbar-plus-menu-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface, #f1f5f9);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
}
.ai-chatbar-plus-menu-label {
  flex: 1;
}
.ai-chatbar-plus-menu-hint {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  background: var(--surface, #f1f5f9);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ── Popup back button ── */

.ai-chatbar-popup-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  border-bottom: 1px solid var(--line, #e2e8f0);
  margin-bottom: 4px;
}
.ai-chatbar-popup-back:hover {
  color: var(--text, #0f172a);
}

/* ── Skills popup items ── */

.ai-chatbar-skills-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #0f172a);
  text-align: left;
  transition: background 0.15s;
}
.ai-chatbar-skills-popup-item:hover {
  background: var(--surface, #f1f5f9);
}
.ai-chatbar-skills-popup-item span:first-child {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.ai-chatbar-skills-section {
  padding: 4px 0 0;
}
.ai-chatbar-skills-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #64748b);
  padding: 6px 14px 4px;
}
.ai-chatbar-skills-custom-list {
  max-height: 160px;
  overflow-y: auto;
}
.ai-chatbar-skills-empty {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  padding: 6px 14px;
}
.ai-chatbar-skill-custom-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 14px 2px 8px;
}
.ai-chatbar-skill-custom-run {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #0f172a);
  text-align: left;
  border-radius: 6px;
  transition: background 0.15s;
}
.ai-chatbar-skill-custom-run:hover {
  background: var(--surface, #f1f5f9);
}
.ai-chatbar-skill-custom-edit,
.ai-chatbar-skill-custom-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted, #64748b);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.ai-chatbar-skill-custom-edit:hover,
.ai-chatbar-skill-custom-delete:hover {
  color: var(--text, #0f172a);
  background: var(--surface, #f1f5f9);
}
.ai-chatbar-skill-custom-delete:hover {
  color: #b91c1c;
}
.ai-chatbar-skill-form {
  padding: 10px 14px;
  border-top: 1px solid var(--line, #e2e8f0);
  margin: 4px 0 0;
}
.ai-chatbar-skill-form-name,
.ai-chatbar-skill-form-prompt {
  width: 100%;
  display: block;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.ai-chatbar-skill-form-prompt {
  resize: vertical;
  min-height: 52px;
}
.ai-chatbar-skill-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.ai-chatbar-skill-form-btn {
  padding: 6px 12px;
  border: 1px solid var(--line, #e2e8f0);
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text, #0f172a);
}
.ai-chatbar-skill-form-btn.primary {
  background: var(--primary, #2d457f);
  color: #fff;
  border-color: var(--primary, #2d457f);
}
.ai-chatbar-skill-new {
  margin-top: 4px;
  border-top: 1px dashed var(--line, #e2e8f0);
}

/* ── Mention popup ── */

.ai-chatbar-mention-popup-results {
  max-height: 200px;
  overflow-y: auto;
}
.ai-chatbar-search--inline {
  border-bottom: none;
  padding: 6px 14px;
}
.ai-chatbar-search--inline input {
  font-size: 12px;
}

/* ── Input area ── */

.ai-chatbar-input-area {
  border-top: 1px solid var(--line, #e2e8f0);
  padding: 12px 16px;
  flex-shrink: 0;
  position: relative;
  background: #fff;
}
.ai-chatbar-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--surface, #f1f5f9);
  border-radius: 12px;
  padding: 4px 4px 4px 8px;
}
.ai-chatbar-input-row textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  line-height: 1.5;
  padding: 6px 4px;
  resize: none;
  color: var(--text, #0f172a);
  max-height: 120px;
  font-family: inherit;
}
.ai-chatbar-input-row textarea::placeholder {
  color: var(--text-muted, #64748b);
}
.ai-chatbar-attach-btn,
.ai-chatbar-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  background: transparent;
  color: var(--text-muted, #64748b);
}
.ai-chatbar-attach-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text, #0f172a);
}
.ai-chatbar-attach-btn.is-active {
  color: var(--accent, #3b82f6);
}
.ai-chatbar-send-btn {
  background: var(--accent, #3b82f6);
  color: #fff;
}
.ai-chatbar-send-btn:hover {
  opacity: 0.9;
}
.ai-chatbar-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Mentions dropdown ── */

.ai-chatbar-mentions-dropdown {
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
}
.ai-chatbar-mentions-dropdown.hidden {
  display: none;
}
.ai-chatbar-mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text, #0f172a);
  text-align: left;
  transition: background 0.15s;
}
.ai-chatbar-mention-item:hover {
  background: var(--surface, #f1f5f9);
}
.ai-chatbar-mention-item.highlighted {
  background: var(--surface, #e2e8f0);
}
.ai-chatbar-mention-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.ai-chatbar-mention-type {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted, #64748b);
  text-transform: capitalize;
}

/* Forecast / replenishment recommendation attached to Pilot AI chat */
.ai-chatbar-rec-context {
  padding: 0 0 6px;
}
.ai-chatbar-rec-context.hidden {
  display: none;
}
.ai-chatbar-rec-context-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(14, 165, 233, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 12px;
  line-height: 1.3;
  max-width: 100%;
}
.ai-chatbar-rec-context-icon {
  display: inline-flex;
  color: var(--accent, #6366f1);
  flex-shrink: 0;
}
.ai-chatbar-rec-context-link {
  color: var(--text, #0f172a);
  text-decoration: none;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(100%, 220px);
}
.ai-chatbar-rec-context-link:hover {
  text-decoration: underline;
  color: var(--accent, #6366f1);
}
.ai-chatbar-rec-context-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.ai-chatbar-rec-context-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.ai-chatbar-rec-context-remove:hover {
  color: var(--text, #0f172a);
  background: rgba(15, 23, 42, 0.06);
}

.ai-chatbar-mention-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
}
.ai-chatbar-mention-pills:empty {
  display: none;
}
.ai-chatbar-mention-pills:not(:empty) {
  padding-bottom: 6px;
}
.ai-chatbar-mention-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent, #3b82f6);
  font-size: 12px;
}
.ai-chatbar-mention-pill button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.ai-chatbar-mention-pill button:hover {
  color: var(--text, #0f172a);
}
.ai-chatbar-mention-pill-link {
  color: inherit;
  text-decoration: none;
}
.ai-chatbar-mention-pill-link:hover {
  text-decoration: underline;
}

/* Mention pills shown inside user message bubbles */
/* User message: attachment filenames (when file was uploaded) */
.ai-chatbar-msg-attachments {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
}
.ai-chatbar-msg-attachments-label {
  font-weight: 500;
}
.ai-chatbar-msg-attachments-names {
  word-break: break-all;
}

.ai-chatbar-msg-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.ai-chatbar-mention-pill--in-msg {
  padding: 3px 8px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.ai-chatbar-mention-pill--in-msg:hover {
  background: rgba(255, 255, 255, 0.35);
}
.ai-chatbar-msg-mentions a.ai-chatbar-mention-pill--in-msg {
  color: inherit;
  text-decoration: none;
}
.ai-chatbar-msg-mentions a.ai-chatbar-mention-pill--in-msg:hover {
  text-decoration: underline;
}

/* Attachment pills (below mentions, above input) */
.ai-chatbar-attachment-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  min-height: 0;
}
.ai-chatbar-attachment-pills.hidden {
  display: none;
}
.ai-chatbar-attachment-pills:not(.hidden):not(:empty) {
  padding-bottom: 6px;
}
.ai-chatbar-attachment-pill,
.ai-chatbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent, #3b82f6);
  font-size: 12px;
}
.ai-chatbar-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.ai-chatbar-pill-remove:hover {
  color: var(--text, #0f172a);
}

/* ── Budget & Purchase Plans ─────────────────── */

.budget-setup-method-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.budget-setup-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.budget-setup-card:hover {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.02);
}

.budget-setup-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

.budget-setup-card input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
}

.budget-setup-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.budget-setup-card-body strong {
  font-size: 14px;
}

.budget-setup-card-body .muted {
  font-size: 12px;
}

.budget-setup-card-body .pill {
  margin-top: 4px;
  width: fit-content;
}

.budget-setup-params {
  margin-bottom: 24px;
}

.budget-setup-period {
  margin-bottom: 24px;
}

.budget-setup-period h3 {
  margin-bottom: 8px;
}

.budget-setup-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.budget-setup-advanced {
  margin-bottom: 24px;
}

.budget-setup-advanced summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 12px;
}

.budget-preview-section {
  margin-bottom: 24px;
}

.budget-preview-section h3 {
  margin-bottom: 8px;
}

.btn-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.btn-group-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  border-right: 1px solid var(--line);
  transition: background 0.15s ease;
}

.btn-group-item:last-child {
  border-right: none;
}

.btn-group-item:hover {
  background: var(--bg);
}

.btn-group-item:has(input:checked) {
  background: var(--accent);
  color: #fff;
}

.btn-group-item input[type="radio"] {
  display: none;
}

/* Budget fit bar */
.budget-fit-panel {
  padding: 16px;
}

.budget-fit-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  margin-bottom: 8px;
}

.budget-fit-segment {
  transition: width 0.5s ease;
  position: relative;
}

.budget-fit-segment:hover {
  opacity: 0.85;
}

.budget-fit-prior { background: #94a3b8; }
.budget-fit-must { background: #ef4444; }
.budget-fit-should { background: #2563eb; }
.budget-fit-consol { background: #14b8a6; }
.budget-fit-remaining { background: #e2e8f0; }

.budget-fit-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.budget-fit-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.budget-fit-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.budget-fit-dot.budget-fit-prior { background: #94a3b8; }
.budget-fit-dot.budget-fit-must { background: #ef4444; }
.budget-fit-dot.budget-fit-should { background: #2563eb; }
.budget-fit-dot.budget-fit-consol { background: #14b8a6; }
.budget-fit-dot.budget-fit-remaining { background: #e2e8f0; }

/* Why this plan panel */
.budget-why-panel {
  border-left: 4px solid var(--accent);
}

.budget-why-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.budget-why-body li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.budget-why-body li:last-child {
  border-bottom: none;
}

.budget-warning-text {
  color: var(--danger, #ef4444);
}

/* Vendor alerts */
.budget-vendor-alerts .budget-vendor-alert {
  padding: 8px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.budget-vendor-alerts .budget-vendor-alert:last-child {
  border-bottom: none;
}

/* Plan comparison bar */
.budget-comparison-bar {
  margin-bottom: 16px;
}
.budget-comparison-bar .btn-group-link {
  display: block;
  padding: 6px 14px;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
}
.budget-comparison-bar .btn-group-link.is-active {
  background: var(--accent);
  color: #fff;
}

/* Plan items table — scrollable container; allow dropdown to show above next section */
.plan-vendor-group {
  position: relative;
}
.plan-vendor-group[open] {
  z-index: 10;
}
.plan-vendor-group .dropdown-menu {
  z-index: 100;
}

.plan-vendor-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.plan-vendor-table-wrap .data-table {
  min-width: 800px;
}

/* Data table group header */
.data-table-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

/* Collapsible vendor groups */
.plan-vendor-group summary.data-table-group-header {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.plan-vendor-group summary.data-table-group-header::-webkit-details-marker { display: none; }
.plan-vendor-group summary.data-table-group-header::marker { display: none; content: ""; }

.plan-vendor-toggle {
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.15s ease;
  display: inline-block;
}
.plan-vendor-group[open] .plan-vendor-toggle {
  transform: rotate(90deg);
}

/* Plan item reason column — allow wrapping */
.data-table td.plan-reason-col {
  white-space: normal;
  max-width: 280px;
  word-break: break-word;
}

/* Plan item info button (why this recommendation) */
.plan-item-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px;
  vertical-align: middle;
  font-size: 0.875rem;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.plan-item-info-btn:hover {
  color: var(--accent);
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.plan-item-info-btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Plan item explanation modal */
/* Deferred section: hidden when no deferred items (JS can show and append) */
#deferred-items-section.is-empty {
  display: none;
}

.plan-item-explanation-content {
  width: min(520px, 92vw);
}
.plan-item-explanation-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 2px;
}
.plan-item-explanation-sku {
  font-size: 0.875rem;
  margin: 0;
}
.plan-item-explanation-section {
  margin-bottom: 20px;
}
.plan-item-explanation-section:last-child {
  margin-bottom: 0;
}
.plan-item-explanation-section h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0 0 8px;
}
.plan-item-explanation-reason {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #475569;
}
.plan-item-explanation-dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 24px;
  margin: 0;
  font-size: 0.9rem;
}
.plan-item-explanation-dl dt {
  margin: 0;
  color: #64748b;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.plan-item-explanation-dl dd {
  margin: 0;
  text-align: right;
}

/* Action bar */
.budget-action-bar {
  position: sticky;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.budget-action-bar .actions {
  display: flex;
  gap: 8px;
}

/* Budget utilization labels */
.budget-util-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 4px;
}

/* Utility colors */
.text-success { color: #16a34a; }
.text-warning { color: #d97706; }
.text-danger { color: #ef4444; }

/* Info pill variant */
.pill-info {
  background: #dbeafe;
  color: #1e40af;
}

/* Grid 5 column */
.grid.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Grid 3 column */
.grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Form grid 2 col */
.form-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* Dashboard budget widget */
.budget-widget {
  margin-top: 16px;
}

.budget-widget-prompt {
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: rgba(37, 99, 235, 0.03);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* PO budget badge */
.po-budget-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1e40af;
}


/* Simple mode (LLM-first policy) */
.policy-simple-mode {
  max-width: min(1440px, calc(100vw - 64px));
}
.policy-simple-hero,
.policy-simple-global-card,
.policy-simple-overrides-panel,
.policy-simple-editor {
  margin-bottom: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line, #e5e7eb);
  background: var(--panel, #fff);
  padding: 20px;
}
.policy-simple-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) auto;
  gap: 20px 28px;
  align-items: start;
}
.policy-simple-hero__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, #2563eb);
}
.policy-simple-hero__title {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
}
.policy-simple-hero__copy {
  margin: 0;
  max-width: 720px;
  color: var(--muted, #6b7280);
  line-height: 1.6;
}
.policy-simple-hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  width: 100%;
}
.policy-simple-stat {
  padding: 14px 16px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  background: var(--soft, #f1f5f9);
}
.policy-simple-stat__value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink, #1f2933);
}
.policy-simple-stat__label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.policy-simple-hero__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.policy-simple-layout {
  display: block;
}
.policy-simple-main {
  min-width: 0;
  max-width: 1240px;
}
.policy-simple-presets-panel,
.policy-guided-workbench,
.policy-guided-trust-panel {
  margin-bottom: 24px;
}
.policy-simple-overview {
  margin-bottom: 24px;
}
.policy-simple-overview__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 20px;
  margin-top: 12px;
}
.policy-simple-step__eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #2563eb);
}
.policy-simple-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.policy-preset-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 180px;
  padding: 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.policy-preset-card.is-active {
  border-color: #93c5fd;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}
.policy-preset-card__eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #2563eb);
}
.policy-preset-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.policy-simple-document-shell {
  display: grid;
  grid-template-columns: minmax(0, 2.6fr) minmax(280px, 1fr);
  gap: 20px;
  margin-top: 12px;
}
.policy-simple-document {
  min-width: 0;
}
.policy-simple-document__content {
  min-height: 320px;
  padding: 24px 28px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}
.policy-simple-summary-card {
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: var(--soft, #f8fafc);
}
.policy-simple-summary-card__eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}
.policy-simple-summary { margin-top: 8px; }
.policy-simple-summary p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.7;
}
.policy-simple-summary p:last-child { margin-bottom: 0; }
.policy-simple-summary-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line, #e5e7eb);
  font-size: 13px;
  color: var(--muted, #6b7280);
}
.policy-simple-support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.policy-simple-link-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.policy-simple-link-card p {
  margin: 0;
}
.policy-simple-link-card__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}
.policy-simple-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.policy-simple-disclosure {
  margin-top: 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: #fbfdff;
}
.policy-simple-disclosure[open] {
  background: #fff;
}
.policy-simple-disclosure--spacious {
  margin-top: 0;
}
.policy-simple-disclosure__summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 600;
}
.policy-simple-disclosure__summary::-webkit-details-marker {
  display: none;
}
.policy-simple-disclosure__summary::after {
  content: "+";
  float: right;
  color: var(--muted, #6b7280);
}
.policy-simple-disclosure[open] .policy-simple-disclosure__summary::after {
  content: "-";
}
.policy-simple-disclosure__body {
  padding: 0 18px 18px;
}
.policy-simple-document__content--compact {
  min-height: 0;
  margin: 0 18px 18px;
  padding: 18px 20px;
}
.policy-guided-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.policy-guided-section {
  height: 100%;
}
.policy-guided-section__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #1f2933);
}
.policy-guided-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.policy-guided-fields--bridge {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.policy-guided-field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1f2933);
}
.policy-guided-form__actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.policy-guided-section__empty {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--line, #e5e7eb);
  border-radius: 12px;
  background: var(--soft, #f8fafc);
}
.policy-guided-settings-bridge {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: #fbfdff;
}
.policy-guided-settings-bridge__links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
}
.policy-guided-trust-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.policy-guided-trust-card {
  padding: 16px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.policy-guided-trust-card__label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
}
.policy-exception-form {
  margin: 8px 0 18px;
  padding: 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: #fbfdff;
}
.policy-exception-grid,
.policy-exception-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.policy-exception-fields {
  margin-top: 14px;
}
.policy-simple-overrides-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.policy-simple-empty {
  padding: 24px;
  border: 1px dashed var(--line, #e5e7eb);
  border-radius: 12px;
  background: var(--soft, #f1f5f9);
}
.policy-simple-empty h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.policy-simple-empty p {
  margin: 0;
}
.policy-simple-empty--document {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.policy-simple-editor {
  margin-top: 20px;
  padding: 24px;
  background: #f8fbff;
}
.policy-simple-editor__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent, #2563eb);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.policy-simple-editor__field {
  display: block;
  margin-top: 12px;
}
.policy-simple-rich-text {
  min-height: 360px;
  margin-top: 8px;
  border: 1px solid var(--line, #e5e7eb);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 18px 20px;
  background: #fff;
  font-size: 15px;
  line-height: 1.65;
}
.policy-simple-editor trix-toolbar {
  margin-top: 0;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 0 0 12px 12px;
  background: #fff;
  padding: 6px 8px 8px;
}
.policy-simple-editor trix-toolbar .trix-button-row {
  margin-bottom: 0;
}
.policy-simple-editor trix-toolbar .trix-button-group {
  border: none;
  box-shadow: none;
  background: transparent;
}
.policy-simple-editor trix-toolbar .trix-button {
  border: none;
  background: transparent;
}
.policy-simple-editor trix-toolbar .trix-button-group--file-tools {
  display: none;
}
.policy-simple-editor__tips {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--soft, #f1f5f9);
}
.policy-simple-editor__tips p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.policy-simple-input-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.policy-simple-proposed-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line, #e5e7eb);
}
.policy-simple-footnote {
  margin-top: 4px;
}

/* Override card */
.policy-override-card {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 18px;
  background: var(--panel, #fff);
  box-shadow: var(--shadow, 0 1px 2px rgba(15, 23, 42, 0.05));
}
.policy-override-card__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.policy-override-card__eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #6b7280);
}
.policy-override-card__summary { font-size: 14px; margin-bottom: 12px; }
.policy-override-card__summary p { margin: 0 0 6px; line-height: 1.6; color: var(--ink, #1f2933); }
.policy-override-card__summary p:last-child { margin-bottom: 0; }
.policy-override-card__meta { font-size: 12px; }
.policy-override-card__actions { display: flex; gap: 8px; }
.policy-override-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.policy-override-card__tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft, #f1f5f9);
  color: var(--muted, #6b7280);
  font-size: 11px;
  font-weight: 600;
}

/* Proposed changes confirmation */
.policy-proposed-changes {
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #f8fbff;
}
.policy-proposed-changes__title { font-size: 15px; margin: 0 0 8px; }
.policy-proposed-changes__preview { margin: 0 0 12px; font-size: 14px; }
.policy-proposed-changes__list {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
}
.policy-proposed-changes__list li { margin-bottom: 4px; }
.policy-proposed-changes__actions { display: flex; gap: 8px; }

@media (max-width: 1080px) {
  .policy-simple-document-shell {
    grid-template-columns: 1fr;
  }

  .policy-simple-overview__grid,
  .policy-simple-support-grid {
    grid-template-columns: 1fr;
  }

  .policy-guided-section-grid,
  .policy-guided-fields,
  .policy-guided-fields--bridge,
  .policy-guided-trust-grid,
  .policy-exception-grid,
  .policy-exception-fields {
    grid-template-columns: 1fr;
  }

  .policy-simple-mode {
    max-width: calc(100vw - 32px);
  }
}

@media (max-width: 720px) {
  .policy-simple-mode {
    max-width: calc(100vw - 24px);
  }

  .policy-simple-hero {
    grid-template-columns: 1fr;
  }

  .policy-simple-hero__stats {
    grid-template-columns: 1fr;
  }

  .policy-simple-overrides-list {
    grid-template-columns: 1fr;
  }

  .policy-simple-link-row {
    flex-direction: column;
    gap: 8px;
  }

  .policy-simple-document__content,
  .policy-simple-empty--document,
  .policy-simple-rich-text {
    min-height: 240px;
  }
}

/* ── Policy show (simplified) ──────────────────────────── */
.policy-show { max-width: none; }
.policy-show__preset-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent-weak, #e0e7ff);
  color: var(--accent, #2563eb);
}
.policy-show__preset-badge--custom {
  background: var(--soft, #f1f5f9);
  color: var(--muted, #6b7280);
}
/* ── Policy hero / intro card ── */
.policy-hero {
  background: linear-gradient(135deg, #f0f5ff 0%, #f8fafc 50%, #ecfdf5 100%);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.policy-hero__visual {
  flex-shrink: 0;
}
.policy-hero__icon-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.policy-hero__text {
  flex: 1;
  min-width: 0;
}
.policy-hero__tagline {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink, #1f2933);
  margin: 0 0 6px;
  line-height: 1.35;
}
.policy-hero__text p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-light, #475569);
  margin: 0;
}
.policy-hero__text p:last-child {
  margin-bottom: 0;
}
.policy-hero__text strong {
  color: var(--ink, #1f2933);
}
@media (max-width: 720px) {
  .policy-hero {
    flex-direction: column;
    text-align: center;
    padding: 20px;
    gap: 16px;
  }
}

.policy-show__sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.policy-show__card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 20px;
  position: relative;
  transition: box-shadow 0.15s ease;
}
.policy-show__card--editing {
  box-shadow: 0 0 0 2px var(--accent, #2563eb);
}
.policy-show__card h3 { margin: 0 0 4px; font-size: 15px; }
.policy-show__card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}
.policy-show__edit-btn {
  flex-shrink: 0;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--muted, #6b7280);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.policy-show__card:hover .policy-show__edit-btn { opacity: 1; }
.policy-show__edit-btn:hover { color: var(--accent, #2563eb); }
.policy-show__card-fields { display: grid; gap: 10px; }
.policy-show__field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  gap: 12px;
}
.policy-show__field--editing {
  flex-direction: column;
  gap: 4px;
}
.policy-show__field-label { color: var(--muted); }
.policy-show__field-value { font-weight: 600; text-align: right; }
.policy-show__field-input { width: 100%; }
.policy-show__field-input .input--sm {
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
}
.policy-show__field-hint { display: block; font-size: 11px; margin-top: 2px; }
.policy-show__inline-form { display: contents; }
.policy-show__inline-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #e5e7eb);
}

.policy-show__exceptions {
  margin-top: 24px;
}
.policy-show__exceptions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.policy-show__exceptions-header h3 { margin: 0 0 2px; }
.policy-show__exceptions-header p { margin: 0; }
/* Rules card scope bar — same pattern as PO line items “Review” scopes */
.policy-show__exceptions .policy-show__rules-scope-bar.panel-index-scopes {
  margin: 0 -16px 14px -16px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}
.policy-show__exceptions .panel-index-scopes button.scope-pill {
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
}
.policy-exception-row.policy-exception-row--filtered-out {
  display: none !important;
}
.policy-show__rules-filter-empty {
  margin: 0 0 12px;
  font-size: 13px;
}
.policy-show__exceptions-list { display: grid; gap: 10px; }
.policy-show__exceptions-empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}
.policy-exception-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-size: 13px;
}
.policy-exception-row__type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}
.policy-exception-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.policy-exception-row__tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--soft);
  font-size: 12px;
  color: var(--muted);
}
.policy-show__links {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

/* Exception modal */
.policy-exception-modal .modal-content { max-width: 780px; width: 90vw; }
.policy-exception-modal__scope { display: grid; gap: 14px; margin-bottom: 18px; }
.policy-exception-modal__fields { margin-bottom: 18px; }
.policy-exception-modal__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  margin-top: 10px;
}
.policy-exception-modal__actions { display: flex; gap: 8px; }

/* ── Rule modal (unified Add/Edit rule) ─────────────── */
dialog.modal.rule-modal { overflow: visible; }
.rule-modal .modal-content {
  max-width: 920px;
  width: 94vw;
  max-height: 92vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.rule-modal .modal-header {
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  margin-bottom: 0;
}
.rule-modal .modal-header h2 {
  font-size: 16px;
  margin: 0;
}
.rule-modal__form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.rule-modal__scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 0 20px;
}
.rule-modal__section {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.rule-modal__section:last-child { border-bottom: none; }
.rule-modal__section--scope { padding-top: 16px; padding-bottom: 12px; }
.rule-modal__section--conditions { padding-bottom: 16px; }
.rule-modal__section-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}
.rule-modal__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Scope pills */
.rule-modal__scope-pills {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.rule-modal__scope-pill {
  padding: 6px 14px;
  border: none;
  background: var(--panel);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 120ms ease;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.rule-modal__scope-pill:last-child { border-right: none; }
.rule-modal__scope-pill:hover { background: var(--soft); color: var(--ink); }
.rule-modal__scope-pill.is-active {
  background: var(--accent, #2563eb);
  color: #fff;
  font-weight: 600;
}
.rule-modal__scope-pill:disabled:not(.is-active) {
  opacity: 0.4;
  cursor: default;
}
.rule-modal__scope-pill.is-restricted {
  opacity: 0.35;
  text-decoration: line-through;
  cursor: not-allowed;
}
.rule-modal__scope-warning {
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  border: 1px solid #fde68a;
}
.rule-modal__scope-identifier { margin-top: 10px; }
.rule-modal__scope-identifier .form-field { max-width: 340px; }

/* Picker dropdown — two-panel drill-down, position:fixed to escape overflow clipping */
.rule-modal__picker-wrap { position: relative; }
.rule-modal__picker-dropdown {
  position: fixed;
  z-index: 99999;
  width: 360px;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18);
  padding: 0;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}
.rule-modal__picker-dropdown.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ── Picker panel (shared) ── */
.picker-panel { padding: 6px; }
.picker-panel__header {
  position: sticky;
  top: 0;
  background: var(--panel, #fff);
  z-index: 1;
  padding: 4px 4px 6px;
}
.picker-panel__search {
  width: 100%;
  font-size: 13px;
}
.picker-panel__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.picker-panel__empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--muted, #6b7280);
  font-size: 13px;
}

/* ── Category list ── */
.picker-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 8px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 80ms ease;
}
.picker-cat:hover { background: var(--soft, #f8fafc); }
.picker-cat--dimmed { opacity: 0.4; pointer-events: none; }
.picker-cat__icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.picker-cat__icon--sm { width: 24px; height: 24px; border-radius: 6px; }
.picker-cat__icon--sm svg { width: 14px; height: 14px; }
.picker-cat__text { flex: 1; min-width: 0; }
.picker-cat__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1f2933);
  line-height: 1.3;
}
.picker-cat__desc {
  display: block;
  font-size: 11px;
  color: var(--muted, #6b7280);
  line-height: 1.3;
  margin-top: 1px;
}
.picker-cat__count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #6b7280);
  background: var(--soft, #f1f5f9);
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}
.picker-cat__chevron {
  flex-shrink: 0;
  color: var(--muted, #94a3b8);
}

/* ── Back button ── */
.picker-panel__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent, #2563eb);
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 6px;
  transition: background 80ms ease;
}
.picker-panel__back:hover { background: var(--soft, #f1f5f9); }

/* ── Category title bar in items view ── */
.picker-panel__cat-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #1f2933);
  padding: 4px 10px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Item row ── */
.picker-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 80ms ease;
}
.picker-item:hover:not(:disabled) { background: var(--soft, #f8fafc); }
.picker-item__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink, #1f2933);
  display: flex;
  align-items: center;
  gap: 6px;
}
.picker-item__hint {
  font-size: 11px;
  color: var(--muted, #6b7280);
  line-height: 1.35;
}
.picker-item__cat-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.picker-item--added {
  opacity: 0.4;
  cursor: default;
}
.picker-item--added .picker-item__label { text-decoration: line-through; }
.picker-item--restricted {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Added rules list — compact horizontal layout */
.rule-modal__added-rules {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rule-modal__empty-state {
  text-align: center;
  padding: 20px 10px;
}
.rule-modal__empty-state p { margin: 8px 0 0; font-size: 13px; }
.rule-modal__added-rule {
  padding: 8px 12px;
  background: var(--soft);
  border-radius: 8px;
  border: 1px solid var(--line);
  animation: ruleSlideIn 180ms ease;
}
@keyframes ruleSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rule-modal__rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rule-modal__rule-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.rule-modal__rule-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.rule-modal__rule-controls .input--sm { width: 140px; }
.rule-modal__category-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.rule-modal__rule-label {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rule-modal__rule-default {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.rule-modal__rule-remove {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 80ms ease;
}
.rule-modal__rule-remove:hover { color: var(--error, #ef4444); }
.rule-modal__sub-field {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.rule-modal__sub-field .input--sm { max-width: 220px; margin-top: 2px; }

/* Conditions */
.rule-modal__conditions-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 120ms ease;
}
.rule-modal__conditions-toggle:hover { color: var(--ink); }
.rule-modal__conditions-toggle svg { transition: transform 150ms ease; }
.rule-modal__conditions { margin-top: 10px; }
.rule-modal__conditions .condition-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  animation: ruleSlideIn 150ms ease;
}
.rule-modal__conditions-op-wrap { font-size: 13px; color: var(--muted); }

/* Sticky footer */
.rule-modal__validation-error {
  padding: 8px 20px;
  font-size: 13px;
  line-height: 1.4;
  color: #991b1b;
  background: #fef2f2;
  border-top: 1px solid #fecaca;
  flex-shrink: 0;
}
.rule-modal__footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.tag--conditions {
  background: #ede9fe;
  color: #6d28d9;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

/* Policy rules list — conditional badge is the tooltip trigger */
.policy-rules-cond-tooltip {
  margin-left: 0;
}
.policy-rules-cond-tooltip .tag.tag--conditions.help-tooltip-trigger {
  appearance: none;
  border: none;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  cursor: help;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
  white-space: nowrap;
}
.policy-rules-cond-tooltip .help-tooltip-trigger:hover,
.policy-rules-cond-tooltip .help-tooltip-trigger:focus {
  color: #6d28d9;
  outline: none;
  filter: brightness(0.97);
}

/* ── Strategy wizard ──────────────────────────────────── */
.wizard-shell { max-width: 720px; margin: 0 auto; }
.wizard-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  overflow-x: auto;
}
.wizard-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 72px;
  flex-shrink: 0;
}
.wizard-progress__dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--line);
  color: var(--muted);
  background: var(--panel);
}
.wizard-progress__step--active .wizard-progress__dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.wizard-progress__step--completed .wizard-progress__dot {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}
.wizard-progress__label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}
.wizard-progress__step--active .wizard-progress__label {
  color: var(--ink);
  font-weight: 600;
}
.wizard-progress__line {
  flex: 1;
  height: 2px;
  background: var(--line);
  min-width: 20px;
  margin-top: -18px;
}
.wizard-progress__line--done { background: var(--accent-weak); }

.wizard-card {
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.wizard-card h2 { margin: 0 0 8px; font-size: 22px; }
.wizard-card__step-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 8px;
}
.wizard-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.wizard-preset-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.wizard-preset-card.is-active {
  border-color: #93c5fd;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.12);
}
.wizard-preset-card h3 { margin: 0 0 6px; font-size: 17px; }
.wizard-preset-card--custom {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.wizard-preset-card--custom div { flex: 1; }
.wizard-preset-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-weak);
  color: var(--accent);
}
.wizard-fields { display: grid; gap: 20px; margin: 20px 0 0; }
.wizard-field { }
.wizard-field__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.wizard-field__hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.wizard-notice {
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--soft);
  margin-bottom: 16px;
}
.wizard-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
}

@media (max-width: 720px) {
  .policy-show__sections { grid-template-columns: 1fr; }
  .policy-exception-row { grid-template-columns: 1fr; }
  .policy-exception-modal__grid { grid-template-columns: 1fr; }
  .rule-modal__scope-pills { flex-wrap: wrap; }
  .rule-modal__picker-dropdown { width: 300px; }
  .rule-modal__rule-row { flex-direction: column; align-items: stretch; }
  .rule-modal__rule-controls { justify-content: flex-end; }
  .rule-modal__conditions .condition-row { grid-template-columns: 1fr; }
  .wizard-presets { grid-template-columns: 1fr; }
}

/* ============================================================
   MOBILE RESPONSIVE — max-width: 768px
   All rules below are additive and only apply on mobile.
   Desktop layout is untouched.
   ============================================================ */

/* ── Mobile hamburger button in global header ──────────────── */
.header-mobile-menu-btn {
  display: none;
}

@media (max-width: 768px) {
  /* Zero out the shell gutter so there's no dark body padding visible on mobile */
  body.pp-body {
    --shell-gutter: 0px;
    padding: 0;
    background: #f6f7f9;
  }

  /* Clip any sidebar overflow so it can't bleed into view */
  .super-shell {
    overflow-x: hidden;
  }

  /* Sidebar: fully hidden off-screen by default on mobile */
  .sidebar {
    visibility: hidden;
  }

  /* Header: show hamburger, compress search */
  .header-mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: rgba(248, 250, 252, 0.1);
    border: none;
    border-radius: 8px;
    color: #f8fafc;
    cursor: pointer;
    padding: 0;
    margin-right: 4px;
  }
  .header-mobile-menu-btn svg {
    width: 20px;
    height: 20px;
  }
  .header-mobile-menu-btn:hover {
    background: rgba(248, 250, 252, 0.2);
  }

  /* Shrink and reposition the header search bar */
  .header-search {
    min-width: 0;
    flex: 1;
    max-width: 220px;
  }
  .header-search-shortcut {
    display: none;
  }

  /* Hide keyboard shortcut hints */
  .header-ai-chat-btn {
    display: none;
  }

  /* Shrink account switcher text to save space */
  .account-switcher-pill {
    font-size: 11px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── App rail: hide on mobile (navigation lives in sidebar drawer) ── */
  .app-rail {
    display: none;
  }

  /* ── App shell: full width, no left offset ── */
  .app-shell {
    padding-left: 0 !important;
  }

  /* Header: full width (no shell-gutter offset) */
  .header-bar {
    left: 0;
    right: 0;
  }

  /* ── Sidebar: mobile drawer ── */
  .sidebar {
    left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    top: 0;
    height: 100vh;
  }

  /* Sidebar open state */
  .app-shell.is-mobile-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  /* Sidebar backdrop overlay */
  .sidebar-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 199;
    cursor: pointer;
  }
  .app-shell.is-mobile-open .sidebar-mobile-backdrop {
    display: block;
  }

  /* Ensure the sidebar corner decoration doesn't show */
  .sidebar-corner {
    display: none;
  }
  .sidebar-hover-zone {
    display: none !important;
  }

  /* Desktop collapsed state overrides: always show sidebar normally on mobile when open */
  .app-shell.is-collapsed .sidebar {
    transform: translateX(-100%);
    visibility: hidden;
  }
  .app-shell.is-collapsed.is-mobile-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .app-shell.is-collapsed {
    padding-left: 0 !important;
  }
  .app-shell.is-collapsed .main {
    margin-left: 0;
  }

  /* Show hamburger buttons in topbars always on mobile */
  .hamburger-button {
    display: grid !important;
  }

  /* ── Main content area ── */
  .main {
    min-width: 0;
    margin-left: 0 !important;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  /* ── Topbar: allow wrapping of toolbar-row on very narrow screens ── */
  .topbar {
    height: auto;
    min-height: 52px;
  }
  .toolbar-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ── AI chatbar: full-screen overlay on mobile, don't push content ── */
  body:has(.ai-chatbar-panel--open) .app-shell,
  body:has(.ai-chatbar-panel--expanded) .app-shell {
    margin-right: 0 !important;
  }
  body:has(.ai-chatbar-panel--open) .header-bar,
  body:has(.ai-chatbar-panel--expanded) .header-bar {
    right: 0 !important;
  }
  .ai-chatbar-panel {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    border-radius: 0 !important;
  }
}

/* ============================================================
   MOBILE RESPONSIVE — Phase 3: Data Tables
   ============================================================ */

@media (max-width: 768px) {
  /* Safety net: ensure all table containers scroll horizontally */
  .table-wrap,
  .table-panel,
  .data-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Slightly tighter table cells on small screens */
  .data-table th,
  .data-table td {
    padding: 10px 10px;
    font-size: 13px;
  }

  .data-table-compact th,
  .data-table-compact td {
    padding: 7px 8px;
    font-size: 12px;
  }

  /* Content pages with page padding: reduce it */
  .content {
    padding: 12px;
  }
  .topbar + .content {
    padding-top: 12px;
  }

  /* Reduce panel padding on mobile */
  .panel {
    border-radius: 10px;
  }
  .panel-header {
    padding: 12px 14px;
  }
}

/* ============================================================
   MOBILE RESPONSIVE — Phase 4: Grids, Dashboard, Topbar
   ============================================================ */

@media (max-width: 768px) {
  /* Grid: go single column on phones (< 768px) */
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  /* Dashboard: single column */
  .dashboard-with-feed {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .dashboard-activity-feed {
    position: static;
  }

  /* Topbar: reduce padding */
  .topbar {
    padding: 10px 12px;
  }
  .topbar-title {
    min-width: 0;
  }
  .topbar-title h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Toolbar row: let items wrap */
  .toolbar-row {
    gap: 8px;
  }

  /* Topbar actions: wrap and smaller gap */
  .topbar-actions {
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar-controls {
    gap: 8px;
    flex-wrap: wrap;
  }

  /* Detail layout: single column on mobile */
  .detail-layout {
    grid-template-columns: 1fr;
    padding: 0 12px 24px;
    gap: 12px;
  }
  .detail-sidebar {
    position: static;
  }

  /* KPI rows and metric cards */
  .repl-kpi-row,
  .po-tab-kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================================================
   MOBILE RESPONSIVE — Phase 5: Additional touch-ups
   ============================================================ */

@media (max-width: 768px) {
  /* Modals: full-width on mobile */
  .modal-panel {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0;
    margin: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
  .modal-overlay {
    align-items: flex-end;
  }

  /* Auth card: tighter padding */
  .auth-card {
    padding: 28px 20px;
    margin: 12px;
    border-radius: 16px;
  }

  /* Onboarding: single column steps */
  .ob-vendor-source-cards {
    grid-template-columns: 1fr;
  }

  /* Forecasting: reduce padding on filter bar */
  .forecasting-filters {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Settings nav: smaller */
  .settings-nav {
    gap: 4px;
  }

  /* Report builder: reduce padding */
  .report-chart-wrap {
    min-height: 200px;
  }

  /* Workflow run detail: already has @media at 800px, but also shrink cards */
  .wf-run-detail-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Entity show overview grid: single column */
  .entity-show__overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-bar {
    gap: 8px;
    padding: 0 10px;
  }

  .header-brand,
  .header-actions {
    min-width: 0;
  }

  .header-logo-mark {
    height: 30px;
  }

  .header-actions {
    gap: 6px;
    flex-shrink: 1;
  }

  .impersonation-banner {
    max-width: 180px;
    min-width: 0;
    padding: 4px 8px;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .impersonation-banner form,
  .impersonation-stop-btn {
    flex-shrink: 0;
  }

  .toolbar-row {
    align-items: flex-start;
  }

  .topbar-left,
  .topbar-controls,
  .topbar-actions {
    width: 100%;
  }

  .topbar-left {
    flex-wrap: wrap;
  }

  .topbar-controls {
    flex: 1 1 100%;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .topbar-actions > * {
    flex-shrink: 0;
  }

  .utility-bar {
    align-items: flex-start;
    padding: 10px 12px 8px;
    margin: 0 -12px -12px;
  }

  .utility-bar .filters-inline {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .utility-label,
  .filter-builder-list {
    width: 100%;
  }

  .facet-bar-inline {
    width: 100%;
    gap: 8px;
  }

  .facet-bar-inline::after {
    display: none;
  }

  .repl-stat-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 12px;
    margin: -12px -12px 16px;
  }

  .repl-stat-item {
    min-width: 0;
    padding-right: 0;
    margin-right: 0;
    border-right: none;
  }

  .repl-stat-label {
    white-space: normal;
  }

  .repl-stat-meta {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
  }

  .repl-view-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .repl-view-tab {
    flex: 0 0 auto;
    padding: 10px 12px;
  }

  .repl-vendor-name {
    flex-wrap: wrap;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .per-page-form,
  .per-page-label {
    justify-content: center;
  }

  .pagination .muted,
  .pagination-page {
    text-align: center;
  }

  .pagination-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 520px) {
  .header-search {
    max-width: 150px;
  }

  .account-switcher-pill {
    max-width: 64px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .impersonation-banner {
    max-width: 140px;
    font-size: 11px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .favorite-toggle {
    display: none;
  }

  .repl-stat-value {
    font-size: 18px;
  }

  .pagination-actions .btn {
    flex: 1 1 0;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .toolbar .hamburger-button {
    display: none !important;
  }

  .toolbar-row {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    overflow: visible;
  }

  .topbar-left,
  .topbar-controls,
  .topbar-actions {
    width: auto;
  }

  .topbar-left {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    gap: 10px;
  }

  .topbar-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-title h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-controls,
  .topbar-actions {
    flex: 0 0 auto;
    min-width: max-content;
    flex-wrap: nowrap;
    align-items: center;
  }

  .filters-inline-main {
    flex: 0 0 auto;
    width: auto;
  }

  .filters-inline-main .search {
    position: relative;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    flex: 0 0 32px;
    gap: 0;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    border-color: var(--line);
    border-radius: 8px;
    transition: width 0.16s ease, max-width 0.16s ease, padding 0.16s ease;
  }

  .mobile-search-trigger {
    width: 32px;
    height: 32px;
    pointer-events: auto;
    cursor: pointer;
  }

  .mobile-search-trigger .search-icon-svg {
    pointer-events: none;
  }

  .filters-inline-main .search input {
    width: 0;
    min-width: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
  }

  .filters-inline-main .search.is-mobile-open,
  .filters-inline-main .search:focus-within {
    width: min(220px, 46vw);
    max-width: min(220px, 46vw);
    height: 32px;
    gap: 10px;
    justify-content: flex-start;
    padding: 8px 12px;
  }

  .filters-inline-main .search.is-mobile-open input,
  .filters-inline-main .search:focus-within input {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
    cursor: text;
  }

  .utility-bar {
    overflow: hidden;
  }

  .utility-bar .filter-builder {
    width: 100%;
    min-width: 0;
  }

  .utility-bar .filters-inline {
    width: 100%;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .utility-label,
  .facet-bar-inline,
  .filter-builder-list,
  .filter-builder-row,
  .filter-builder-group,
  .filter-field-picker,
  .filter-field-picker > summary,
  .filters-inline > .btn {
    flex: 0 0 auto;
  }

  .utility-label,
  .filter-builder-list {
    width: auto;
  }

  .facet-bar-inline,
  .filter-builder-list {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  .repl-stat-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    margin: -12px -12px 16px;
  }

  .repl-stat-item {
    flex: 0 0 auto;
    min-width: 132px;
    padding-right: 16px;
    margin-right: 16px;
    border-right: 1px solid var(--line, #e5e7eb);
  }

  .repl-stat-label {
    white-space: nowrap;
  }

  .repl-stat-meta {
    flex: 0 0 auto;
    width: auto;
    margin-left: 0;
    padding-left: 4px;
    align-self: center;
  }

  .column-controls-label {
    display: none;
  }

  .column-controls > summary {
    min-width: 32px;
    width: 32px;
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
  }

  .column-controls .btn-icon-box {
    width: 14px;
    margin-right: 0;
  }
}

/* ═══════════════════════════════════════════════════════════
   Invoice File Upload — multi-format upload hints
   ═══════════════════════════════════════════════════════════ */

.invoice-upload-hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 16px;
}

.invoice-upload-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.invoice-upload-hint svg {
  flex-shrink: 0;
  color: var(--muted);
}

.invoice-upload-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}

.invoice-upload-file-name {
  font-weight: 500;
  color: var(--ink);
}

.invoice-upload-file-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e0e7ff;
  color: #3730a3;
}

.invoice-upload-file-badge.is-pdf { background: #fee2e2; color: #991b1b; }
.invoice-upload-file-badge.is-image { background: #dcfce7; color: #166534; }
.invoice-upload-file-badge.is-csv { background: #dbeafe; color: #1e40af; }

/* ═══════════════════════════════════════════════════════════
   Invoice Extraction — processing / success / error states
   ═══════════════════════════════════════════════════════════ */

.invoice-extraction-spinner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 0;
}

.invoice-extraction-spinner-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: invoice-spin 0.9s linear infinite;
  flex-shrink: 0;
}

@keyframes invoice-spin {
  to { transform: rotate(360deg); }
}

.invoice-extraction-spinner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.invoice-extraction-success {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 0;
  font-size: 14px;
}

.invoice-extraction-success div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.invoice-extraction-error {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 0;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════
   Inbox: Import as Invoice — file summary card
   ═══════════════════════════════════════════════════════════ */

.invoice-import-file-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.invoice-import-file-icon {
  width: 44px;
  height: 44px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════
   Validation — partial import warning + btn-warning
   ═══════════════════════════════════════════════════════════ */

.validate-import-partial-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: #fef9c3;
  border: 1px solid #facc15;
  border-radius: 8px;
  font-size: 13px;
  color: #713f12;
  margin-bottom: 12px;
  width: 100%;
}

.validate-import-partial-warning svg {
  flex-shrink: 0;
  color: #a16207;
  margin-top: 1px;
}

.btn-warning {
  background: #f59e0b;
  color: #fff;
  border-color: #d97706;
  box-shadow: 0 1px 2px rgba(245, 158, 11, 0.18);
}

.btn-warning:hover {
  background: #d97706;
  border-color: #b45309;
  color: #fff;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
}

.btn-warning:active {
  background: #b45309;
  border-color: #92400e;
  box-shadow: none;
}

/* Invoicing status tooltip — badge is the trigger, undo help-tooltip-trigger resets */
.inv-status-tooltip { margin-left: 0; }
.inv-status-tooltip .status-badge.help-tooltip-trigger {
  appearance: none;
  border: none;
  cursor: default;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
.inv-status-tooltip .status-badge--disputed.help-tooltip-trigger { background: #fee2e2; color: #991b1b; }
.inv-status-tooltip .status-badge--accepted.help-tooltip-trigger { background: #dcfce7; color: #166534; }
.inv-status-tooltip .status-badge--pending.help-tooltip-trigger  { background: #fef3c7; color: #92400e; }
.inv-status-tooltip .help-tooltip-trigger:hover,
.inv-status-tooltip .help-tooltip-trigger:focus { color: inherit; }

/* Row-level qty over-invoiced warning */
.row--qty-warning {
  background: #fef9c310;
}
.row--qty-warning td {
  border-bottom-color: #facc1540;
}

/* ═══════════════════════════════════════════════════════════════
   Variant Similarity — modal tab, index badge, settings
   ═══════════════════════════════════════════════════════════════ */

/* ── Tab count badge ── */
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--color-surface-muted, #e5e7eb);
  color: var(--color-text-secondary, #6b7280);
  border-radius: 9px;
  vertical-align: middle;
}
.tab-button.is-active .tab-count {
  background: var(--color-primary-pale, #dbeafe);
  color: var(--color-primary, #2563eb);
}

/* ── Similar variants list (modal) ── */
.similar-variants-header {
  margin-bottom: 12px;
}
.similar-variants-subtitle {
  font-size: 13px;
}
.similar-variants-empty {
  padding: 32px 0;
  text-align: center;
}
.similar-variants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.similar-variant-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  transition: border-color 0.15s;
}
.similar-variant-card:hover {
  border-color: var(--color-border-hover, #d1d5db);
}
.similar-variant-card__image {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
}
.similar-variant-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
}
.product-thumb__avatar--sm {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.similar-variant-card__body {
  flex: 1;
  min-width: 0;
}
.similar-variant-card__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.similar-variant-card__name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.similar-variant-card__product {
  font-weight: 600;
}

/* ── Match score badge ── */
.similar-match-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  white-space: nowrap;
}
.similar-match-badge--high   { background: #dcfce7; color: #15803d; }
.similar-match-badge--medium { background: #fef9c3; color: #92400e; }
.similar-match-badge--low    { background: #f3f4f6; color: #6b7280; }

/* ── Metrics row ── */
.similar-variant-card__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.similar-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
}
.similar-metric__label {
  color: var(--color-text-tertiary, #9ca3af);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.similar-metric__value {
  font-weight: 600;
  font-size: 13px;
}

/* ── ABC badge inside similar variants ── */
.abc-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.abc-badge--a { background: #dcfce7; color: #15803d; }
.abc-badge--b { background: #fef9c3; color: #92400e; }
.abc-badge--c { background: #f3f4f6; color: #6b7280; }

/* ── Why similar? expandable ── */
.similar-why-details {
  font-size: 12px;
  margin-top: 2px;
}
.similar-why-summary {
  cursor: pointer;
  color: var(--color-primary, #2563eb);
  font-size: 12px;
  user-select: none;
  list-style: none;
}
.similar-why-summary::-webkit-details-marker { display: none; }
.similar-why-summary::before { content: "▸ "; font-size: 10px; }
details[open] .similar-why-summary::before { content: "▾ "; }
.similar-why-body {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--color-surface-muted, #f9fafb);
  border-radius: 6px;
}
.similar-factor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.similar-factor-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--color-text-secondary, #6b7280);
  font-size: 11px;
}
.similar-factor-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--color-border, #e5e7eb);
  border-radius: 3px;
  overflow: hidden;
}
.similar-factor-bar {
  height: 100%;
  background: var(--color-primary, #2563eb);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.similar-factor-pct {
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Action column ── */
.similar-variant-card__action {
  flex-shrink: 0;
  align-self: center;
}

/* ── Similar variants callout (overview tab) ── */
.similar-callout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-info-bg, #eff6ff);
  border: 1px solid var(--color-info-border, #bfdbfe);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.similar-callout__icon {
  flex-shrink: 0;
  color: var(--color-primary, #2563eb);
}
.similar-callout__text {
  flex: 1;
}
.similar-callout__link {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
}

/* ── Cluster badge (index row) ── */
.similar-cluster-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--color-primary, #2563eb);
  background: var(--color-primary-pale, #dbeafe);
  border-radius: 9px;
  vertical-align: middle;
  margin-left: 4px;
  text-decoration: none;
}
.similar-cluster-badge:hover {
  background: var(--color-primary-pale-hover, #bfdbfe);
}
.similar-cluster-badge__count {
  font-weight: 700;
  font-size: 11px;
}

/* ── Similarity Settings ─────────────────────────────────── */

/* Panel layout */
.sim-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sim-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.sim-panel__header-text {
  flex: 1;
  min-width: 0;
}
.sim-panel__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}
.sim-panel__desc {
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

/* Toggle row (enable switch & advanced settings rows) */
.sim-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0;
  border-top: 1px solid var(--line, #e5e7eb);
}
.sim-toggle-row:first-of-type {
  border-top: none;
  padding-top: 0;
}
.sim-toggle-row__info {
  flex: 1;
  min-width: 0;
}
.sim-toggle-row__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.sim-toggle-row__desc {
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
}
.sim-num-input {
  width: 80px;
  flex-shrink: 0;
}

/* Status bar */
.sim-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line, #e5e7eb);
  margin-top: 4px;
}
.sim-status-bar--error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 8px;
  border-top: 1px solid #fca5a5;
}
.sim-error-msg {
  color: #b91c1c;
  font-size: 13px;
  font-weight: 500;
}
.sim-status-stats {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  font-size: 13px;
}
.sim-stat {
  font-size: 13px;
  color: var(--ink);
}
.sim-stat strong {
  font-weight: 600;
}
.sim-stat-sep {
  margin: 0 8px;
  color: var(--ink-faint, #9ca3af);
}

/* Weight factor table */
.sim-weights-table {
  margin-top: 0;
}
.sim-weights-table__factor-col {
  width: 200px;
}
.sim-weights-table__enabled-col {
  width: 56px;
  text-align: center;
}
.sim-weights-table__toggle-cell {
  text-align: center;
  vertical-align: middle;
}
.sim-weights-table__row--no-data {
  opacity: 0.55;
}
.sim-weights-table__row--disabled td:not(.sim-weights-table__toggle-cell) {
  opacity: 0.4;
}
.sim-weights-table__row--disabled .sim-factor-name {
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint, #6b7280);
}
.sim-weights-table__row--disabled .sim-slider-wrap {
  pointer-events: none;
}
.sim-weights-table__row--disabled .sim-weight-slider {
  opacity: 0.35;
  cursor: not-allowed;
}
.toggle-switch--sm {
  transform: scale(0.75);
  transform-origin: center;
}
.pill-muted {
  background: var(--bg-subtle, #f3f4f6);
  color: var(--ink-faint, #6b7280);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.sim-weights-table__group-header td {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint, #6b7280);
  padding-top: 14px;
  padding-bottom: 4px;
  border-bottom: none;
}
.sim-factor-name {
  font-weight: 500;
  font-size: 13px;
}

/* Auto-calibrated bar */
.sim-weight-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sim-weight-bar {
  height: 7px;
  background: var(--accent, #2563eb);
  border-radius: 4px;
  min-width: 3px;
  max-width: 200px;
  transition: width 0.3s ease;
}
.sim-weight-pct {
  font-size: 12px;
  color: var(--ink-faint, #6b7280);
  white-space: nowrap;
  min-width: 40px;
}

/* Override slider */
.sim-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sim-weight-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 6px;
  border-radius: 3px;
  background: var(--line, #e5e7eb);
  outline: none;
  cursor: pointer;
}
.sim-weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}
.sim-weight-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}
.sim-slider-pct {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint, #6b7280);
  min-width: 36px;
  text-align: right;
}

/* Priority pills (read-only) */
.sim-priority-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.sim-priority-pill--high {
  background: var(--green-50, #ecfdf5);
  color: var(--green-700, #047857);
}
.sim-priority-pill--medium {
  background: var(--blue-50, #eff6ff);
  color: var(--blue-700, #1d4ed8);
}
.sim-priority-pill--low {
  background: var(--gray-100, #f3f4f6);
  color: var(--ink-faint, #6b7280);
}

/* Segmented toggle buttons (override mode) */
.sim-seg-toggle {
  display: inline-flex;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  overflow: hidden;
}
.sim-seg-toggle--disabled {
  opacity: 0.35;
  pointer-events: none;
}
.sim-seg-toggle__btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface, #fff);
  color: var(--ink-faint, #6b7280);
  border: none;
  border-right: 1px solid var(--border, #d1d5db);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  line-height: 1.4;
}
.sim-seg-toggle__btn:last-child {
  border-right: none;
}
.sim-seg-toggle__btn:hover:not(:disabled) {
  background: var(--gray-50, #f9fafb);
}
.sim-seg-toggle__btn--active {
  background: var(--accent, #2563eb);
  color: #fff;
}
.sim-seg-toggle__btn--active:hover:not(:disabled) {
  background: var(--accent-hover, #1d4ed8);
  color: #fff;
}
.sim-seg-toggle__btn:disabled {
  cursor: not-allowed;
}

/* Progress bar */
.sim-progress-bar-wrap {
  padding: 16px 0 12px;
}
.sim-progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--gray-100, #f3f4f6);
  border-radius: 4px;
  overflow: hidden;
}
.sim-progress-bar-fill {
  height: 100%;
  background: var(--accent, #2563eb);
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 0;
}
.sim-progress-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}
.sim-progress-bar-step {
  font-weight: 600;
  color: var(--ink, #111827);
}
.sim-progress-bar-detail {
  flex: 1;
}
.sim-progress-bar-pct {
  font-weight: 600;
  color: var(--accent, #2563eb);
  min-width: 36px;
  text-align: right;
}

/* Panel actions (button row) */
.sim-panel__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
}

/* ── Auto-draft runs ────────────────────────────────────── */
.skip-reasons-list {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.skip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.auto-draft-summary-grid {
  margin-bottom: 1rem;
}

.auto-draft-skipped-panel {
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.auto-draft-skipped-heading {
  margin: 0 0 8px;
}

.card-value--sm {
  font-size: 16px !important;
  margin-top: 8px;
}
