/*
 * 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;
}

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;
}

.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;
  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-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;
  overflow: hidden;
  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;
}

.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: 24px;
  color: var(--muted);
}

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

.view-switcher[open] .view-menu {
  display: grid;
  gap: 6px;
}

.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: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: #0f172a;
}

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

.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;
}

.selection-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 16px;
}

.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;
}

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

.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 {
  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 .input:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-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;
}

.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;
  display: flex;
  flex-direction: column;
  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;
}

.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-radius: 10px;
  padding: 10px 14px;
  max-width: 520px;
  color: var(--muted);
}

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

.search input {
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
}

.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;
}

.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;
}

.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;
}

.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 {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover {
  border-color: #cbd5f5;
}

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

.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));
}

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

.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;
}

.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;
}

.settings-grid {
  gap: 16px;
}

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

.settings-bucket-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.settings-bucket-link:hover {
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.settings-bucket-link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.settings-bucket-header {
  margin-bottom: 4px;
}

.settings-bucket-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-bucket-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f1f5f9;
  display: grid;
  place-items: center;
  color: #1f2937;
}

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

.settings-bucket-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.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 .form-field {
  gap: 6px;
}

.settings-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 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;
}

.integration-list {
  display: grid;
  gap: 16px;
}

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

.integration-list-header h2 {
  margin: 0 0 6px;
}

.integration-list-items {
  display: grid;
  gap: 12px;
}

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

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

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

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

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

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

.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;
}

.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);
}

.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: 12px;
}

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

.table-panel .table-wrap {
  border: none;
  border-radius: var(--radius);
}

.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;
}

.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: #f1f5f9;
}

.btn-primary:hover {
  background: #1e3a8a;
  border-color: #1e3a8a;
}

.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;
  width: 90px;
}

.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;
}

.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;
}

.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: grid;
  gap: 6px;
}

.rb-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.rb-filter-label {
  color: var(--muted);
  min-width: 60px;
  font-weight: 500;
}

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

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

.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: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);
}

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

.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 {
  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);
}

.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;
}

.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-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.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;
}

.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;
}

.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: 260px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.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;
}

.long-text {
  margin: 0;
  color: #334155;
  line-height: 1.5;
}

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  font-size: 12px;
  overflow-x: auto;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  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: 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));
  }

  .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%;
}

.wizard-actions {
  margin-top: 12px;
}

.wizard-actions-split {
  justify-content: space-between;
}

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

.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: 340px;
  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-header {
  border-bottom: 1px solid var(--line);
}
.panel-index-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.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-shrink: 0;
}
.panel-index-search-form {
  display: flex;
  align-items: center;
}
.panel-index-search-form .search-compact {
  min-width: 200px;
}
.panel-index-filters {
  padding: 6px 16px 8px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.panel-index-filters .filters-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.panel-line-items {
  overflow: visible;
}

/* 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;
}

/* ── 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; }

/* 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;
  gap: 8px;
  flex-shrink: 0;
}

/* 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;
}

/* ── 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-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);
}

/* ── 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 ─────────────── */
.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;
}
.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);
}

.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 p { margin: 0 0 20px; }
.empty-state .btn { margin-top: 4px; }

.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 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--vendor_threshold { background: #fef3c7; color: #92400e; }
.tag--condition { background: #f0fdf4; color: #166534; }
.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-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: var(--soft);
  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: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.ob-mode-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ─── 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-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);
}
.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: grid;
  grid-template-columns: 1fr 1fr;
  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;
}

/* 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-search-bar {
  margin-bottom: 16px;
}
.admin-search-form {
  display: flex;
  gap: 8px;
  max-width: 400px;
}
.admin-search-form .form-input { flex: 1; }

/* 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-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;
}
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle 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 input:checked + .toggle-slider { background: #6366f1; }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.form-inline-row { display: flex; gap: 8px; align-items: flex-end; }
.inline-form { display: inline; }
.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; }

/* 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; }
