* {
  box-sizing: border-box;
}

body.portal-body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-page);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

a {
  color: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-height);
  border: var(--control-border-width) solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--input-bg);
  color: var(--color-text-primary);
  font: inherit;
  padding: 8px var(--control-padding-x);
}

input[type="checkbox"] {
  align-items: center;
  appearance: none;
  background: var(--color-card);
  border: 2px solid var(--input-border);
  border-radius: 4px;
  display: inline-grid;
  flex: 0 0 18px;
  height: 18px;
  justify-content: center;
  margin: 0;
  min-height: 18px;
  padding: 0;
  width: 18px;
}

input[type="checkbox"]::before {
  background: var(--color-text-on-accent);
  clip-path: polygon(14% 44%, 0 59%, 38% 100%, 100% 16%, 84% 0, 36% 66%);
  content: "";
  height: 10px;
  transform: scale(0);
  width: 10px;
}

input[type="checkbox"]:checked {
  background: var(--button-primary-bg);
  border-color: var(--button-primary-bg);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--input-border-hover);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--input-border-focus);
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  cursor: pointer;
  display: inline-flex;
  font-size: var(--button-font-size);
  font-weight: var(--button-font-weight);
  gap: var(--button-gap);
  justify-content: center;
  min-height: var(--button-height);
  padding: 0 var(--button-padding-x);
  text-decoration: none;
  transition: background var(--motion-duration-fast) var(--motion-ease-standard),
    border-color var(--motion-duration-fast) var(--motion-ease-standard);
}

.button:disabled {
  background: var(--button-disabled-bg);
  border-color: var(--button-disabled-border);
  color: var(--button-disabled-fg);
  cursor: not-allowed;
}

.button-primary {
  background: var(--button-primary-bg);
  color: var(--button-primary-fg);
}

.button-primary:hover {
  background: var(--button-primary-bg-hover);
}

.button-secondary {
  background: var(--button-secondary-bg);
  border-color: var(--button-secondary-border);
  color: var(--button-secondary-fg);
}

.button-secondary:hover {
  background: var(--button-secondary-bg-hover);
  border-color: var(--button-secondary-border-hover);
}

.button-danger {
  background: var(--button-danger-bg);
  color: var(--button-danger-fg);
}

.button-danger:hover {
  background: var(--button-danger-bg-hover);
}

.portal-auth-body {
  display: grid;
  place-items: center;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: var(--space-xl);
  place-items: center;
  width: 100%;
}

.auth-panel {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  max-width: var(--login-form-width);
  padding: var(--space-xl);
  width: 100%;
}

.auth-brand,
.sidebar-brand {
  align-items: center;
  display: flex;
  gap: var(--space-md);
}

.auth-brand {
  margin-bottom: var(--space-xl);
}

.brand-mark {
  background: var(--color-accent);
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 14px;
  height: 14px;
  width: 14px;
}

.auth-brand p,
.sidebar-brand p,
.topbar p,
.summary-card span,
.panel-header p,
.module-card span,
.field-help {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  margin: 0;
}

.product-history-link {
  color: inherit;
  display: inline-grid;
  gap: 2px;
  text-decoration: none;
}

.product-history-link strong {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.product-history-link:hover strong,
.product-history-link:focus-visible strong {
  color: var(--color-accent-strong);
  text-decoration-color: currentColor;
}

.product-history-link:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--color-accent-strong);
  outline-offset: 2px;
}

body.has-product-history-modal {
  overflow: hidden;
}

.product-history-modal-backdrop {
  align-items: center;
  background: rgba(17, 24, 39, 0.48);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: var(--space-lg);
  position: fixed;
  z-index: var(--z-modal-backdrop);
}

.product-history-modal {
  background: var(--color-card);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  max-height: min(760px, calc(100vh - 48px));
  max-width: 980px;
  overflow: hidden;
  width: min(100%, 980px);
  z-index: var(--z-modal);
}

.product-history-modal-body {
  max-height: inherit;
  overflow: auto;
}

.product-history-panel-modal {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

.product-history-panel-state {
  min-height: 180px;
}

@media (max-width: 720px) {
  .product-history-modal-backdrop {
    align-items: stretch;
    padding: var(--space-sm);
  }

  .product-history-modal {
    max-height: calc(100vh - 24px);
  }
}

.auth-brand h1,
.topbar h1,
.panel-header h2 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-xl);
  margin: 0;
}

.form-stack {
  display: grid;
  gap: var(--space-md);
}

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

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

.field-wide {
  grid-column: 1 / -1;
}

.form-actions {
  align-items: center;
  display: flex;
  gap: var(--space-sm);
}

.checkbox-row {
  align-items: center;
  color: var(--color-text-secondary);
  display: flex;
  gap: var(--space-xs);
  min-height: var(--control-height-sm);
  width: fit-content;
}

div.choice-stack {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  display: grid;
  gap: var(--space-xs);
  max-height: 180px;
  overflow: auto;
  padding: var(--space-sm);
}

div.choice-stack-compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

div.choice-stack > div,
div.choice-stack label {
  align-items: center;
  color: var(--color-text-secondary);
  display: flex;
  gap: var(--space-xs);
  min-height: var(--control-height-sm);
}

.admin-split-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.admin-action-stack {
  display: grid;
  gap: var(--space-md);
}

.action-card,
.module-access-list {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: var(--space-md);
}

.action-card h3,
.module-access-list h3 {
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
  margin: 0 0 var(--space-sm);
}

.action-card form {
  margin: 0;
}

.module-access-row {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-md);
  grid-template-columns: minmax(0, 1fr) 220px;
  padding: var(--space-sm) 0;
}

.module-access-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.module-access-row:last-child {
  padding-bottom: 0;
}

.module-access-toggle {
  align-items: center;
  display: flex;
  gap: var(--space-sm);
  min-width: 0;
}

.module-access-toggle label {
  color: var(--color-text-primary);
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 700;
  line-height: var(--line-height-sm);
  margin: 0;
}

.module-access-toggle span {
  color: var(--color-text-secondary);
  display: block;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  margin-top: 2px;
}

.module-access-role select {
  min-height: var(--control-height-sm);
}

.module-access-capabilities {
  border-top: 1px dashed var(--color-border);
  display: grid;
  gap: var(--space-sm);
  grid-column: 1 / -1;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(160px, auto));
  padding-top: var(--space-sm);
}

.module-access-capabilities .field {
  margin: 0;
}

.module-access-capabilities .checkbox-row {
  align-self: end;
  min-height: 42px;
}

.field label {
  color: var(--label-color);
  display: block;
  font-size: var(--label-font-size);
  line-height: var(--label-line-height);
  margin-bottom: var(--label-margin-bottom);
}

.field-error,
.form-alert {
  color: var(--field-error-color);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.field-error {
  margin: 6px 0 0;
}

.form-alert {
  background: var(--color-danger-bg-subtle);
  border: 1px solid var(--field-error-color);
  border-radius: var(--radius-input);
  padding: var(--space-sm);
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  padding: var(--space-lg);
  position: sticky;
  top: 0;
  z-index: var(--z-sidebar);
}

.sidebar-brand {
  margin-bottom: var(--space-xl);
}

.sidebar-brand p {
  color: var(--color-sidebar-text-muted);
}

.sidebar-nav {
  display: grid;
  gap: var(--space-xs);
}

.sidebar-link {
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-button) var(--radius-button) 0;
  color: var(--color-sidebar-text-muted);
  display: grid;
  gap: 2px;
  min-height: var(--control-height);
  padding: 8px var(--space-sm);
  text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.is-active {
  background: var(--color-sidebar-hover);
  color: var(--color-sidebar-text);
}

.sidebar-link.is-active {
  border-left-color: var(--color-sidebar-active-border);
}

.sidebar-link small {
  font-size: var(--font-size-xs);
}

.sidebar-section-label {
  color: var(--color-sidebar-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0;
  margin: var(--space-md) 0 var(--space-xs);
  text-transform: uppercase;
}

.main-shell {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: var(--space-md) var(--space-xl);
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
}

.content-shell {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: minmax(0, 1fr);
  padding: var(--space-xl);
}

.summary-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card,
.content-panel,
.module-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.summary-card {
  display: grid;
  gap: 4px;
  padding: var(--space-md);
}

.summary-card strong {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
}

.summary-card small {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.content-panel {
  padding: var(--space-lg);
}

body.has-structure-modal {
  overflow: hidden;
}

.structure-add-backdrop {
  background: color-mix(in srgb, var(--color-text-primary) 58%, transparent);
  inset: 0;
  position: fixed;
  z-index: var(--z-modal-backdrop);
}

.structure-create-panel {
  max-height: calc(100vh - var(--space-xl) - var(--space-xl));
  max-width: 880px;
  overflow: auto;
  width: min(880px, calc(100vw - var(--space-xl) - var(--space-xl)));
}

.structure-create-panel:not([hidden]) {
  left: 50%;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-modal);
}

.structure-add-status {
  border: 1px solid currentColor;
  border-radius: var(--radius-input);
  display: grid;
  gap: 4px;
  margin-bottom: var(--space-md);
  padding: var(--space-sm);
}

.structure-add-status[hidden] {
  display: none;
}

.structure-add-status strong,
.structure-add-status span {
  display: block;
}

.structure-add-status strong {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.structure-add-status span {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
}

.module-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.module-card {
  display: grid;
  gap: 6px;
  padding: var(--space-md);
  text-decoration: none;
}

.module-card:hover {
  background: var(--table-row-hover);
  border-color: var(--input-border-hover);
}

.myday-task-list {
  display: grid;
  gap: var(--space-md);
}

.myday-task-card {
  align-items: center;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  display: grid;
  gap: var(--space-md);
  grid-template-columns: minmax(0, 1fr) auto;
  padding: var(--space-md);
}

.myday-task-card.is-overdue {
  border-color: var(--color-danger);
}

.myday-task-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.myday-task-main h3,
.myday-task-main p {
  margin: 0;
}

.myday-task-main h3 {
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
}

.myday-task-main p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.myday-task-title-row {
  align-items: center;
  display: flex;
  gap: var(--space-sm);
  min-width: 0;
}

.myday-task-title-row h3 {
  min-width: 0;
}

.team-pill {
  background: var(--color-info-bg-subtle);
  color: var(--color-info-fg) !important;
}

.module-placeholder,
.empty-state {
  color: var(--color-text-secondary);
}

.module-placeholder {
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-input);
  display: grid;
  gap: 4px;
  padding: var(--space-lg);
}

.message-stack {
  display: grid;
  gap: var(--space-sm);
}

.flash-modal-stack {
  display: grid;
  gap: var(--space-sm);
  max-width: 420px;
  position: fixed;
  right: var(--space-lg);
  top: var(--space-lg);
  width: min(420px, calc(100vw - var(--space-xl)));
  z-index: var(--z-toast);
}

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

.page-loading-overlay {
  align-items: center;
  background: rgba(17, 24, 39, 0.34);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: var(--space-lg);
  position: fixed;
  z-index: var(--z-modal-backdrop);
}

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

.page-loading-card {
  align-items: center;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  display: flex;
  gap: var(--space-md);
  max-width: 360px;
  padding: var(--space-lg);
  width: min(100%, 360px);
  z-index: var(--z-modal);
}

.page-loading-card > span:last-child {
  display: grid;
  gap: 2px;
}

.page-loading-card strong {
  color: var(--color-text-primary);
}

.page-loading-card span span {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.page-loading-spinner {
  animation: page-loading-spin 800ms linear infinite;
  border: 3px solid var(--color-border);
  border-radius: 999px;
  border-top-color: var(--button-primary-bg);
  flex: 0 0 32px;
  height: 32px;
  width: 32px;
}

@keyframes page-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.flash-modal {
  border: 1px solid currentColor;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-modal);
  display: grid;
  gap: 4px;
  padding: var(--space-md);
}

.flash-modal strong,
.flash-modal span {
  display: block;
}

.flash-modal strong {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.flash-modal span {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.status-message {
  border-radius: var(--radius-input);
  padding: var(--space-sm);
}

.status-success {
  background: var(--color-success-bg-subtle);
  color: var(--color-success-fg);
}

.status-info {
  background: var(--color-info-bg-subtle);
  color: var(--color-info-fg);
}

.status-error {
  background: var(--color-danger-bg-subtle);
  color: var(--color-danger-fg);
}

.status-warning {
  background: var(--color-warning-bg-subtle);
  color: var(--color-warning-fg);
}

.confirm-modal-backdrop {
  align-items: center;
  background: color-mix(in srgb, var(--color-text-primary) 58%, transparent);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: var(--space-lg);
  position: fixed;
  z-index: var(--z-modal-backdrop);
}

.confirm-modal {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  display: grid;
  gap: var(--space-md);
  max-width: 420px;
  padding: var(--space-lg);
  width: min(420px, 100%);
  z-index: var(--z-modal);
}

.confirm-modal h2 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  margin: 0;
}

.confirm-modal p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  margin: 0;
}

.confirm-modal-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .flash-modal-stack {
    left: var(--space-sm);
    right: var(--space-sm);
    top: var(--space-sm);
    width: auto;
  }

  .confirm-modal-backdrop {
    padding: var(--space-sm);
  }

  .structure-create-panel {
    max-height: calc(100vh - var(--space-md) - var(--space-md));
    width: calc(100vw - var(--space-md) - var(--space-md));
  }
}

.purchase-actions {
  align-items: center;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  padding: var(--space-lg);
}

.purchase-actions h2 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-xl);
  margin: 0;
}

.source-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.source-warning {
  background: var(--color-warning-bg-subtle);
  border: 1px solid var(--color-warning-fg);
  border-radius: var(--radius-input);
  color: var(--color-warning-fg) !important;
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
  margin-top: var(--space-xs) !important;
  padding: 6px 10px;
}

.purchase-actions p,
.eyebrow {
  color: var(--color-text-muted);
  margin: 0;
}

.module-tabs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.module-tab {
  align-items: center;
  border-bottom: 3px solid transparent;
  color: var(--color-text-secondary);
  display: inline-flex;
  gap: 6px;
  padding: var(--space-sm) var(--space-md);
  text-decoration: none;
}

.module-tab:hover,
.module-tab.is-active {
  color: var(--color-text-primary);
}

.module-tab.is-active {
  border-bottom-color: var(--color-accent-strong);
  font-weight: var(--font-weight-semibold);
}

.module-tab-setup {
  margin-left: auto;
}

.module-tab-badge {
  align-items: center;
  background: var(--color-accent-soft);
  border-radius: 999px;
  color: var(--color-accent-strong);
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold);
  justify-content: center;
  min-width: 1.35rem;
  padding: 1px 6px;
}

.run-view-tabs {
  align-items: center;
  background: var(--table-header-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  display: inline-flex;
  gap: 4px;
  padding: 4px;
}

.view-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--color-text-secondary);
  cursor: pointer;
  font: inherit;
  font-weight: var(--font-weight-semibold);
  min-height: 34px;
  padding: 0 12px;
}

.view-tab:hover,
.view-tab.is-active {
  background: var(--color-card);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

.filter-bar {
  align-items: end;
  background: var(--table-header-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  display: grid;
  gap: var(--space-md);
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  margin-bottom: var(--space-md);
  padding: var(--space-md);
}

.daily-refill-pick-filter-bar {
  gap: var(--space-sm);
  grid-template-columns:
    minmax(150px, 1.1fr)
    minmax(145px, 1fr)
    minmax(145px, 1fr)
    minmax(145px, 1fr)
    minmax(120px, 0.8fr);
}

.daily-refill-refill-filter-bar {
  gap: var(--space-sm);
  grid-template-columns:
    minmax(145px, 1fr)
    minmax(140px, 1fr)
    minmax(140px, 1fr)
    minmax(120px, 0.8fr)
    minmax(190px, 1.4fr)
    auto;
}

.manager-review-filter-bar {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.daily-refill-pagination {
  align-items: center;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: space-between;
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
}

.daily-refill-pagination > span {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.daily-refill-pagination-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.daily-refill-page-label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  line-height: var(--line-height-sm);
}

.button.is-disabled {
  background: var(--button-disabled-bg);
  border-color: var(--button-disabled-border);
  color: var(--button-disabled-fg);
  cursor: not-allowed;
  pointer-events: none;
}

.purchase-action-buttons {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.purchase-action-buttons form {
  margin: 0;
}

.eyebrow {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

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

.data-table {
  border-collapse: collapse;
  min-width: 980px;
  width: 100%;
}

.data-table th {
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--table-header-border);
  color: var(--table-header-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
  padding: var(--space-sm);
  position: sticky;
  text-align: left;
  top: 0;
  z-index: var(--z-grid-sticky);
}

.sort-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: inherit;
  gap: 6px;
  min-height: 28px;
  padding: 0;
  text-align: left;
}

.sort-button::after {
  color: var(--color-text-muted);
  content: "-";
  font-size: var(--font-size-xs);
}

.data-table th[aria-sort="ascending"] .sort-button::after {
  color: var(--color-accent-strong);
  content: "^";
}

.data-table th[aria-sort="descending"] .sort-button::after {
  color: var(--color-accent-strong);
  content: "v";
}

.data-table td {
  border-bottom: 1px solid var(--color-border);
  min-height: var(--table-row-height);
  padding: var(--space-sm);
  vertical-align: top;
}

.data-table tr:hover td {
  background: var(--table-row-hover);
}

.data-table td span {
  color: var(--color-text-muted);
  display: block;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.status-pill {
  background: var(--color-info-bg-subtle);
  border-radius: 999px;
  color: var(--color-info-fg) !important;
  display: inline-flex !important;
  font-weight: var(--font-weight-semibold);
  padding: 2px 8px;
}

.status-pill-success {
  background: var(--color-success-bg-subtle);
  color: var(--color-success-fg) !important;
}

.status-pill-info {
  background: var(--color-info-bg-subtle);
  color: var(--color-info-fg) !important;
}

.status-pill-warning {
  background: var(--color-warning-bg-subtle);
  color: var(--color-warning-fg) !important;
}

.status-pill-danger {
  background: var(--color-danger-bg-subtle);
  color: var(--color-danger-fg) !important;
}

.status-pill-running,
.status-pill-queued {
  background: var(--color-info-bg-subtle);
  color: var(--color-info-fg) !important;
}

.status-pill-failed,
.status-pill-cancelled {
  background: var(--color-danger-bg-subtle);
  color: var(--color-danger-fg) !important;
}

.status-pill-draft,
.status-pill-finalised {
  background: var(--color-warning-bg-subtle);
  color: var(--color-warning-fg) !important;
}

.status-pill-exported {
  background: var(--color-success-bg-subtle);
  color: var(--color-success-fg) !important;
}

.status-pill-approved {
  background: var(--color-success-bg-subtle);
  color: var(--color-success-fg) !important;
}

.status-pill-pending {
  background: var(--color-warning-bg-subtle);
  color: var(--color-warning-fg) !important;
}

.status-pill-submitted,
.status-pill-picking,
.status-pill-ready,
.status-pill-normal {
  background: var(--color-info-bg-subtle);
  color: var(--color-info-fg) !important;
}

.status-pill-partial,
.status-pill-high {
  background: var(--color-warning-bg-subtle);
  color: var(--color-warning-fg) !important;
}

.status-pill-waiting,
.status-pill-rejected,
.status-pill-critical {
  background: var(--color-danger-bg-subtle);
  color: var(--color-danger-fg) !important;
}

.status-pill-low {
  background: var(--color-success-bg-subtle);
  color: var(--color-success-fg) !important;
}

.status-pill-neutral {
  background: var(--color-surface);
  color: var(--color-text-muted) !important;
}

.error-text {
  color: var(--color-danger-fg) !important;
}

.warning-text {
  color: var(--color-warning-fg) !important;
  display: block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
  margin-bottom: 4px;
}

.compact-table-wrap {
  margin-top: var(--space-md);
}

.drilldown-panel .compact-table-wrap {
  margin-top: 0;
}

.compact-table {
  min-width: 720px;
}

.compact-table td {
  min-height: var(--table-row-height-compact);
}

.supplier-summary-row > td {
  background: #FFF7ED;
}

.supplier-summary-row:hover > td {
  background: #FFEDD5;
}

.supplier-summary-row.is-expanded td {
  background: #FFE6D6;
}

.product-summary-row.is-expanded td {
  background: #FEF3C7;
}

.outlet-summary-row.is-expanded td,
.source-summary-row.is-expanded td {
  background: var(--table-row-selected);
}

.supplier-detail-row > td,
.outlet-detail-row > td,
.source-detail-row > td {
  background: var(--color-card);
  padding: 0 var(--space-sm) var(--space-md);
}

.supplier-detail-row:hover > td,
.outlet-detail-row:hover > td,
.source-detail-row:hover > td {
  background: var(--color-card);
}

.supplier-detail-row > td,
.supplier-detail-row:hover > td {
  background: #FFFBEB;
}

.product-detail-row > td,
.product-detail-row:hover > td {
  background: #DBEAFE;
  padding: 0 var(--space-md) var(--space-md);
}

.drilldown-panel {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent-strong);
  border-radius: var(--radius-input);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.drilldown-panel-products {
  background: #FFFBEB;
  margin: var(--space-sm) 0 var(--space-md);
}

.drilldown-panel-outlets {
  background: #E0F2FE;
  border-left-color: var(--color-info-fg);
  box-shadow: none;
  margin: var(--space-sm) 0 var(--space-sm) var(--space-lg);
}

.drilldown-panel-products > .drilldown-panel-header {
  background: #FEF3C7;
}

.drilldown-panel-products > .compact-table-wrap {
  background: #FFFBEB;
}

.drilldown-panel-products > .compact-table-wrap > .data-table thead th {
  background: #FEF3C7;
}

.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row > td {
  background: #FFFBEB;
}

.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row:hover > td {
  background: #FFEDD5;
}

.data-table thead th.column-group-request,
.data-table tbody td.column-group-request,
.drilldown-panel-products > .compact-table-wrap > .data-table thead th.column-group-request,
.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row > td.column-group-request,
.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row:hover > td.column-group-request,
.drilldown-panel-outlets .data-table thead th.column-group-request,
.drilldown-panel-outlets .data-table tbody tr td.column-group-request,
.drilldown-panel-outlets .data-table tbody tr:hover td.column-group-request {
  background: #DBEAFE;
}

.data-table thead th.column-group-sales,
.data-table tbody td.column-group-sales,
.drilldown-panel-products > .compact-table-wrap > .data-table thead th.column-group-sales,
.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row > td.column-group-sales,
.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row:hover > td.column-group-sales,
.drilldown-panel-outlets .data-table thead th.column-group-sales,
.drilldown-panel-outlets .data-table tbody tr td.column-group-sales,
.drilldown-panel-outlets .data-table tbody tr:hover td.column-group-sales {
  background: #FEF3C7;
}

.drilldown-panel-outlets > .drilldown-panel-header {
  background: #DBEAFE;
}

.drilldown-panel-outlets .compact-table-wrap {
  background: #E0F2FE;
}

.drilldown-panel-outlets .data-table thead th {
  background: #DBEAFE;
}

.drilldown-panel-outlets .data-table tbody tr td {
  background: #EFF6FF;
}

.drilldown-panel-outlets .data-table tbody tr:hover td {
  background: #DBEAFE;
}

.product-detail-panel[hidden] {
  display: none;
}

.product-detail-panel .compact-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.drilldown-panel-sources {
  border-left-color: var(--color-warning-fg);
  box-shadow: none;
  margin: var(--space-sm) 0 var(--space-sm) var(--space-lg);
}

.drilldown-panel-header {
  align-items: center;
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-md);
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
}

.drilldown-panel-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.drilldown-panel-actions form {
  margin: 0;
}

.product-list-toolbar {
  align-items: center;
  background: var(--table-header-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
}

.product-batch-status {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.product-list-toolbar .product-batch-status {
  margin-right: auto;
}

.drilldown-panel-header strong {
  display: block;
}

.drilldown-panel-header span,
.drilldown-count {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.drilldown-count {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-secondary);
  flex: 0 0 auto;
  font-weight: var(--font-weight-semibold);
  padding: 4px 10px;
}

.drilldown-panel .data-table th {
  position: static;
  z-index: var(--z-base);
}

.drilldown-panel.product-detail-panel .data-table th {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

/* Purchase planning drilldown hierarchy: supplier -> product -> outlet. */
.supplier-summary-row > td {
  background: #FFE2D2 !important;
}

.supplier-summary-row:hover > td {
  background: #FFD2BD !important;
}

.supplier-summary-row.is-expanded > td {
  background: #FFC9B3 !important;
}

.supplier-detail-row > td,
.supplier-detail-row:hover > td {
  background: #FFF1E6 !important;
}

.drilldown-panel-products {
  background: #FFF4CC !important;
  border-left-color: var(--color-accent-strong);
}

.drilldown-panel-products > .drilldown-panel-header {
  background: #FDE68A !important;
}

.drilldown-panel-products > .compact-table-wrap,
.drilldown-panel-products > .compact-table-wrap > .data-table {
  background: #FFF7D6 !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table thead th {
  background: #FDE68A !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row > td {
  background: #FFF7D6 !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row:hover > td {
  background: #FFEEC2 !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table tbody > tr.product-summary-row.is-expanded > td {
  background: #FFE4CC !important;
}

.product-detail-row > td,
.product-detail-row:hover > td {
  background: #D7ECFF !important;
}

.drilldown-panel-outlets {
  background: #D7ECFF !important;
  border-left-color: #1D4ED8;
}

.drilldown-panel-outlets > .drilldown-panel-header {
  background: #BFDBFE !important;
}

.drilldown-panel-outlets .compact-table-wrap,
.drilldown-panel-outlets .data-table {
  background: #D7ECFF !important;
}

.drilldown-panel-outlets .data-table thead th {
  background: #BFDBFE !important;
}

.drilldown-panel-outlets .data-table tbody tr td {
  background: #EAF4FF !important;
}

.drilldown-panel-outlets .data-table tbody tr:hover td {
  background: #DCEBFF !important;
}

.data-table th.column-request-30,
.data-table td.column-request-30,
.data-table tr:hover td.column-request-30 {
  background: #EDE9FE !important;
}

.data-table th.column-request-60,
.data-table td.column-request-60,
.data-table tr:hover td.column-request-60 {
  background: #DDD6FE !important;
}

.data-table th.column-request-90,
.data-table td.column-request-90,
.data-table tr:hover td.column-request-90 {
  background: #C4B5FD !important;
}

.data-table th.column-sales-l30,
.data-table td.column-sales-l30,
.data-table tr:hover td.column-sales-l30 {
  background: #DCFCE7 !important;
}

.data-table th.column-sales-month-1,
.data-table td.column-sales-month-1,
.data-table tr:hover td.column-sales-month-1 {
  background: #CCFBF1 !important;
}

.data-table th.column-sales-month-2,
.data-table td.column-sales-month-2,
.data-table tr:hover td.column-sales-month-2 {
  background: #BAE6FD !important;
}

.data-table th.column-sales-month-3,
.data-table td.column-sales-month-3,
.data-table tr:hover td.column-sales-month-3 {
  background: #FDE68A !important;
}

.data-table th.column-sales-month-4,
.data-table td.column-sales-month-4,
.data-table tr:hover td.column-sales-month-4 {
  background: #FED7AA !important;
}

/* Keep purchase metric columns visible even when row-level colours are active. */
.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-request.column-request-30,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-request.column-request-30 {
  background: #EDE9FE !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-request.column-request-60,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-request.column-request-60 {
  background: #DDD6FE !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-request.column-request-90,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-request.column-request-90 {
  background: #C4B5FD !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-sales.column-sales-l30,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-sales.column-sales-l30 {
  background: #DCFCE7 !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-1,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-1 {
  background: #CCFBF1 !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-2,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-2 {
  background: #BAE6FD !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-3,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-3 {
  background: #FDE68A !important;
}

.drilldown-panel-products > .compact-table-wrap > .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-4,
.drilldown-panel-outlets .data-table.compact-table :is(th, td).column-group-sales.column-sales-month-4 {
  background: #FED7AA !important;
}

.line-edit-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-edit-form {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.compact-line-edit-form {
  flex-wrap: nowrap;
}

.compact-line-edit-form .qty-input {
  width: 76px;
}

.product-edit-form .qty-input[readonly] {
  background: var(--color-surface);
  cursor: default;
}

.product-edit-form .qty-input:not([readonly]):not(:disabled) {
  background: var(--color-card);
  border-color: var(--color-accent-strong);
}

.qty-input {
  min-height: 34px;
  padding: 0 10px;
  width: 96px;
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
}

.inline-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.inline-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-sm) 0;
}

.inline-form input {
  min-height: 34px;
}

.inline-date-field {
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  font-size: var(--font-size-xs);
  gap: 4px;
  line-height: var(--line-height-xs);
}

.inline-date-field input {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
}

.structure-lists-grid {
  align-items: start;
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.structure-list-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--space-xs);
  display: grid;
  gap: var(--space-sm);
  min-width: 0;
  padding: var(--space-sm);
}

.structure-list-card-header {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-sm);
  justify-content: space-between;
  min-width: 0;
  padding-bottom: var(--space-xs);
}

.structure-list-card-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-xs);
}

.structure-list-card-header h3 {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--control-gap);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  margin: 0;
  min-width: 0;
}

.structure-list-heading {
  display: grid;
  gap: var(--label-margin-bottom);
  min-width: 0;
}

.structure-list-count {
  align-items: center;
  background: var(--table-header-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  display: inline-flex;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  justify-content: center;
  line-height: var(--line-height-xs);
  min-width: var(--line-height-sm);
  padding: 0 var(--space-xs);
}

.structure-list-meta {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  margin: 0;
  overflow-wrap: anywhere;
}

.structure-list-add {
  align-items: center;
  border-radius: var(--radius-button);
  color: var(--color-text-secondary);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-sm);
  min-height: var(--control-height-sm);
  padding: 0 var(--space-xs);
  text-decoration: none;
}

.structure-list-add:hover,
.structure-list-add:focus-visible {
  background: var(--button-ghost-bg-hover);
  color: var(--color-accent-strong);
}

.structure-list-body {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
}

.structure-bulk-form {
  align-items: center;
  background: var(--table-header-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--space-xs);
  display: flex;
  gap: var(--space-sm);
  justify-content: space-between;
  min-width: 0;
  padding: var(--space-sm);
}

.structure-bulk-form[hidden] {
  display: none;
}

.structure-bulk-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: flex-end;
}

.structure-bulk-count {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
}

.structure-list-item {
  border: 1px solid transparent;
  border-radius: var(--space-xs);
  display: grid;
  gap: var(--space-sm);
  margin: 0;
  min-width: 0;
  padding: var(--space-sm);
  transition: background var(--motion-duration-fast) var(--motion-ease-standard),
    border-color var(--motion-duration-fast) var(--motion-ease-standard);
}

.structure-list-item:hover,
.structure-list-item:focus-within {
  background: var(--table-row-hover);
  border-color: var(--color-border);
}

.structure-list-summary {
  align-items: start;
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

.structure-list-card.is-selecting .structure-list-summary {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.structure-select-box {
  align-items: center;
  display: inline-flex;
  min-height: var(--control-height-sm);
}

.structure-select-box[hidden] {
  display: none;
}

.structure-select-box input {
  margin: 0;
}

.structure-list-copy {
  min-width: 0;
}

.structure-list-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.structure-list-summary span {
  color: var(--color-text-secondary);
  display: block;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.structure-list-actions,
.structure-editor-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: flex-end;
}

.structure-list-item .structure-action-edit {
  background: var(--button-ghost-bg);
  border-color: transparent;
  color: var(--button-ghost-fg);
}

.structure-list-item .structure-action-edit:hover,
.structure-list-item .structure-action-edit:focus-visible {
  background: var(--button-ghost-bg-hover);
  color: var(--color-text-primary);
}

.structure-list-item .structure-action-remove {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}

.structure-list-item .structure-action-remove:hover,
.structure-list-item .structure-action-remove:focus-visible {
  background: var(--color-danger-bg-subtle);
  color: var(--color-danger-fg);
}

.structure-edit-fields {
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-sm);
  min-width: 0;
  padding-top: var(--space-sm);
}

.structure-edit-fields[hidden] {
  display: none;
}

.structure-edit-field {
  color: var(--label-color);
  display: grid;
  font-size: var(--label-font-size);
  gap: var(--label-margin-bottom);
  line-height: var(--label-line-height);
  min-width: 0;
}

.structure-edit-field > span {
  color: var(--label-color);
  font-size: var(--label-font-size);
  font-weight: var(--font-weight-medium);
  line-height: var(--label-line-height);
}

.structure-edit-fields input,
.structure-edit-fields select {
  min-width: 0;
}

.structure-edit-fields .checkbox-row {
  min-height: var(--control-height-sm);
}

.structure-empty-state {
  background: var(--table-header-bg);
  border: 1px dashed var(--color-text-muted);
  border-radius: var(--space-xs);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  padding: var(--space-sm);
}

@media (max-width: 1100px) {
  .structure-lists-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .structure-lists-grid {
    grid-template-columns: 1fr;
  }
}

.daily-refill-run {
  margin-top: var(--space-md);
}

.daily-refill-meta {
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: var(--space-md) 0;
}

.daily-refill-meta-item {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent-strong);
  border-radius: var(--radius-input);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--space-xs) var(--space-sm);
}

.daily-refill-meta-label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.daily-refill-meta-value {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-sm);
}

.daily-refill-meta-note {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.daily-refill-run > summary {
  cursor: pointer;
  list-style: none;
}

.daily-refill-run > summary::-webkit-details-marker {
  display: none;
}

.daily-refill-run-header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.daily-refill-run-summary {
  align-items: stretch;
  flex-direction: column;
  gap: var(--space-sm);
}

.daily-refill-run-summary-main {
  align-items: center;
  display: flex;
  gap: var(--space-md);
  justify-content: space-between;
}

.daily-refill-run-blocker {
  align-items: center;
  background: var(--color-warning-bg-subtle);
  border: 1px solid var(--color-warning-fg);
  border-radius: var(--radius-input);
  color: var(--color-warning-fg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
}

.daily-refill-run-blocker > strong,
.daily-refill-run-blocker > span {
  color: inherit;
}

.daily-refill-run-blocker > .button {
  margin-left: auto;
}

.daily-refill-workflow-tabs {
  border-top: 1px solid var(--color-border);
  margin-top: 0;
  padding: var(--space-sm) var(--space-md) 0;
}

.daily-refill-workflow-panel[hidden] {
  display: none;
}

.daily-refill-step-panel {
  border-top: 1px solid var(--color-border);
  padding: var(--space-md);
}

.daily-refill-step-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.daily-refill-step-header > :first-child {
  flex: 1 1 260px;
}

.daily-refill-step-header h3 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  margin: 0;
}

.daily-refill-step-header p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  margin: 2px 0 0;
}

.daily-refill-step-stats {
  align-items: stretch;
  display: grid;
  flex: 0 1 380px;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: var(--space-xs);
  justify-content: flex-end;
}

.daily-refill-step-stat {
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-left: 4px solid var(--color-border-strong);
  border-radius: var(--space-xs);
  color: var(--color-text-secondary);
  display: grid;
  font-size: var(--font-size-sm);
  gap: 2px;
  line-height: var(--line-height-sm);
  min-height: 62px;
  min-width: 0;
  padding: 9px var(--space-sm);
}

.daily-refill-step-stat-primary {
  border-left-color: var(--color-accent-strong);
}

.daily-refill-step-stats-three {
  flex-basis: 580px;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.daily-refill-step-stat strong {
  color: var(--color-text-primary);
  font-size: var(--font-size-xl);
  font-variant-numeric: tabular-nums;
  line-height: var(--line-height-xl);
  overflow-wrap: anywhere;
}

.daily-refill-step-stat span {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  overflow-wrap: anywhere;
}

.daily-refill-pick-totals .daily-refill-step-stat-primary strong {
  color: var(--color-accent-strong);
}

@media (max-width: 760px) {
  .daily-refill-step-stats {
    flex-basis: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .daily-refill-step-stat {
    min-width: 0;
  }
}

.daily-refill-print-actions {
  flex: 1 1 420px;
  justify-content: flex-end;
}

.daily-refill-print-sheet {
  display: none;
}

.daily-refill-actions,
.daily-refill-mini-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.daily-refill-actions {
  align-items: flex-start;
  flex-direction: column;
  min-width: 180px;
}

.daily-refill-action-form {
  display: inline-flex;
}

.daily-refill-table-input,
.daily-refill-reason-input {
  min-height: 34px;
  padding: 0 10px;
}

.daily-refill-table-input {
  width: 76px;
}

.daily-refill-reason-input {
  min-width: 140px;
}

.daily-refill-mini-form input {
  min-height: 34px;
  padding: 0 10px;
  width: 82px;
}

.daily-refill-mini-form input[type="text"] {
  width: 112px;
}

.daily-refill-source-list {
  margin-top: var(--space-sm);
  min-width: 360px;
}

.daily-refill-run-close {
  align-items: center;
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
}

.daily-refill-run-close input {
  max-width: 320px;
}

.daily-refill-bulk-form {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 var(--space-sm);
}

.daily-refill-bulk-form [data-bulk-pick-line] {
  display: none !important;
}

.daily-refill-problem-panel {
  display: grid;
  gap: var(--space-xs);
}

.daily-refill-problem-panel > summary {
  cursor: pointer;
  list-style: none;
  width: max-content;
}

.daily-refill-problem-panel > summary::-webkit-details-marker {
  display: none;
}

.daily-refill-last-update {
  align-items: flex-start;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 128px;
}

.daily-refill-last-update strong {
  color: var(--color-text-primary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.daily-refill-last-update > span:last-child:not(.status-pill) {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  overflow-wrap: anywhere;
}

.daily-refill-destination-panel {
  display: grid;
  gap: var(--space-xs);
}

.daily-refill-destination-panel > summary {
  align-items: center;
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--space-xs);
  cursor: pointer;
  display: inline-grid;
  gap: var(--space-sm);
  grid-template-columns: minmax(0, 1fr) auto;
  list-style: none;
  max-width: 320px;
  min-height: 64px;
  padding: var(--space-xs) var(--space-sm);
  width: 100%;
}

.daily-refill-destination-panel.is-missing-destination > summary {
  background: var(--color-warning-bg-subtle);
  border-color: var(--color-warning);
}

.daily-refill-destination-panel > summary:hover,
.daily-refill-destination-panel > summary:focus-visible {
  background: var(--button-secondary-bg-hover);
  border-color: var(--button-secondary-border-hover);
}

.daily-refill-destination-panel > summary::-webkit-details-marker {
  display: none;
}

.daily-refill-readonly-location {
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--space-xs);
  display: inline-grid;
  max-width: 320px;
  min-height: 64px;
  padding: var(--space-xs) var(--space-sm);
  width: 100%;
}

.daily-refill-destination-value {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.daily-refill-destination-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.daily-refill-destination-heading > span:first-child {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
  text-transform: uppercase;
}

.daily-refill-destination-empty {
  display: grid;
  gap: 2px;
}

.daily-refill-destination-empty strong {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.daily-refill-destination-empty span {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.daily-refill-destination-row {
  align-items: baseline;
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: 42px minmax(0, 1fr);
  min-width: 0;
}

.daily-refill-destination-row > :last-child {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  min-width: 0;
  overflow-wrap: anywhere;
}

.daily-refill-destination-label {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
  text-transform: uppercase;
}

.daily-refill-destination-edit {
  align-items: center;
  color: var(--color-accent-strong);
  display: inline-flex;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  gap: 4px;
  justify-content: center;
  white-space: nowrap;
}

.daily-refill-destination-edit .icon {
  flex: 0 0 auto;
}

.daily-refill-destination-form {
  display: grid;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  max-width: 320px;
}

.daily-refill-location-section {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--color-border);
  border-radius: var(--space-xs);
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
  padding: var(--space-xs);
}

.daily-refill-location-section-required {
  border-color: var(--color-border-strong);
}

.daily-refill-location-section legend {
  align-items: center;
  color: var(--color-text-primary);
  display: flex;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  gap: 6px;
  line-height: var(--line-height-xs);
  padding: 0 3px;
}

.daily-refill-location-section legend span:last-child {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
}

.daily-refill-location-help,
.daily-refill-location-section label > span {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
}

.daily-refill-location-section label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.daily-refill-location-fields-two {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.daily-refill-destination-form input {
  min-width: 0;
  width: 100%;
}

.daily-refill-destination-form .button {
  width: 100%;
}

.daily-refill-storage-shelf-form {
  display: grid;
  gap: var(--space-xs);
  margin-top: 6px;
  max-width: 320px;
}

.daily-refill-storage-shelf-form input {
  min-width: 0;
  width: 100%;
}

.daily-refill-storage-shelf-form .button {
  width: 100%;
}

.request-item-history {
  margin-top: var(--space-xs);
}

.request-item-history > summary {
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.request-item-history span {
  display: block;
  margin-top: 3px;
}

@media (max-width: 720px) {
  .daily-refill-step-panel .compact-table-wrap {
    overflow: visible;
  }

  .daily-refill-step-panel .data-table {
    display: block;
  }

  .daily-refill-step-panel .data-table thead {
    display: none;
  }

  .daily-refill-step-panel .data-table tbody {
    display: grid;
    gap: var(--space-sm);
  }

  .daily-refill-step-panel .data-table tr[data-daily-refill-line] {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: grid;
    padding: var(--space-xs);
  }

  .daily-refill-step-panel .data-table tr[data-daily-refill-line] td {
    border-bottom: 0;
    display: grid;
    gap: var(--space-xs);
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
    padding: 7px 8px;
  }

  .daily-refill-step-panel .data-table tr[data-daily-refill-line] td::before {
    color: var(--color-text-muted);
    content: attr(data-label);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
  }

  .daily-refill-step-panel .data-table tr[data-daily-refill-line] td:first-child {
    grid-template-columns: 1fr;
  }

  .daily-refill-step-panel .data-table tr[data-daily-refill-line] td:first-child::before {
    display: none;
  }

  .daily-refill-mini-form {
    align-items: stretch;
    flex-direction: column;
  }

  .daily-refill-mini-form input,
  .daily-refill-mini-form .button,
  .daily-refill-actions .button {
    width: 100%;
  }
}

@media print {
  @page {
    margin: 10mm;
    size: A4 landscape;
  }

  body.daily-refill-print-mode * {
    visibility: hidden !important;
  }

  body.daily-refill-print-mode [data-daily-pick-list].is-printing,
  body.daily-refill-print-mode [data-daily-pick-list].is-printing * {
    visibility: visible !important;
  }

  body.daily-refill-print-mode [data-daily-pick-list].is-printing {
    background: #fff;
    color: #111;
    left: 0;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }

  body.daily-refill-print-mode [data-daily-pick-list].is-printing > :not(.daily-refill-print-sheet),
  body.daily-refill-print-mode .daily-refill-screen-only {
    display: none !important;
  }

  body.daily-refill-print-mode .daily-refill-print-sheet {
    display: block !important;
    font-size: 9pt;
    line-height: 1.25;
  }

  body.daily-refill-print-mode .daily-refill-print-header {
    align-items: flex-end;
    border-bottom: 2px solid #111;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8mm;
    padding-bottom: 3mm;
  }

  body.daily-refill-print-mode .daily-refill-print-header h2,
  body.daily-refill-print-mode .daily-refill-print-header p {
    margin: 0;
  }

  body.daily-refill-print-mode .daily-refill-print-header p,
  body.daily-refill-print-mode .daily-refill-print-header span,
  body.daily-refill-print-mode .daily-refill-print-totals span {
    color: #333;
  }

  body.daily-refill-print-mode .daily-refill-print-totals {
    display: grid;
    gap: 1mm 5mm;
    grid-template-columns: auto auto;
    text-align: right;
  }

  body.daily-refill-print-mode .daily-refill-print-totals strong {
    font-size: 16pt;
  }

  body.daily-refill-print-mode .daily-refill-print-table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
  }

  body.daily-refill-print-mode .daily-refill-print-table th,
  body.daily-refill-print-mode .daily-refill-print-table td {
    border: 1px solid #999;
    padding: 5px 6px;
    text-align: left;
    vertical-align: top;
  }

  body.daily-refill-print-mode .daily-refill-print-table th {
    background: #eee;
    color: #111;
    font-weight: 700;
  }

  body.daily-refill-print-mode .daily-refill-print-table th:nth-child(1) {
    width: 18mm;
  }

  body.daily-refill-print-mode .daily-refill-print-table th:nth-child(3) {
    width: 12mm;
  }

  body.daily-refill-print-mode .daily-refill-print-table th:nth-child(6) {
    width: 18mm;
  }

  body.daily-refill-print-mode .daily-refill-print-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

.manager-review-form {
  display: grid;
  gap: var(--space-md);
}

.manager-review-toolbar {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md);
}

.manager-review-toolbar label {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.manager-review-toolbar input,
.manager-review-toolbar select {
  min-height: 34px;
}

.rack-setup-panel {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
}

.rack-setup-panel > summary {
  color: var(--color-accent-strong);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-md);
}

.product-save-status,
.line-save-status {
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 130px;
}

.product-edit-form[data-state="saving"] .qty-input {
  border-color: var(--color-info-fg);
}

.product-edit-form[data-state="saved"] .qty-input {
  border-color: var(--color-success-fg);
}

.product-edit-form[data-state="error"] .qty-input,
.product-edit-form[data-state="conflict"] .qty-input {
  border-color: var(--color-danger-fg);
}

.product-edit-form[data-state="dirty"] .qty-input {
  background: var(--color-warning-bg-subtle);
  border-color: var(--color-warning-fg);
}

.inline-action {
  background: transparent;
  border: 0;
  color: var(--color-accent-strong);
  cursor: pointer;
  font: inherit;
  font-weight: var(--font-weight-semibold);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inline-action:hover {
  color: var(--color-accent-strong-hover);
}

.inline-action.drilldown-toggle {
  align-items: start;
  display: inline-grid;
  gap: 8px;
  grid-template-columns: 16px minmax(0, 1fr);
  justify-items: start;
  text-align: left;
  text-decoration: none;
}

.drilldown-toggle::before {
  color: var(--color-text-muted);
  content: ">";
  font-size: var(--font-size-xs);
  line-height: var(--line-height-sm);
  transition: transform var(--motion-duration-fast) var(--motion-ease-standard);
}

.drilldown-toggle[aria-expanded="true"]::before {
  color: var(--color-accent-strong);
  transform: rotate(90deg);
}

.drilldown-toggle-text {
  color: inherit !important;
  display: grid !important;
  gap: 2px;
}

.request-block {
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
}

.request-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.request-block-header {
  align-items: flex-start;
  display: flex;
  gap: var(--space-md);
  justify-content: space-between;
}

.request-block-header h3 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  margin: 0;
}

.request-block-header p,
.export-history {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  margin: 0;
}

.history-section {
  gap: var(--space-sm);
}

.history-section-header {
  align-items: center;
  background: var(--color-info-bg-subtle);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-info-fg);
  border-radius: 8px;
  padding: var(--space-sm) var(--space-md);
}

.history-section-header h3 {
  color: var(--color-text-primary);
  font-size: var(--font-size-xl);
  line-height: var(--line-height-xl);
}

.request-history-heading {
  margin-top: var(--space-sm);
}

.request-history-request {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: block;
  overflow: hidden;
  padding: 0;
}

.request-history-request + .request-history-request {
  margin-top: var(--space-sm);
}

.request-history-request > summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: 24px minmax(0, 1fr) auto;
  list-style: none;
  padding: var(--space-md);
}

.request-history-request > summary::-webkit-details-marker {
  display: none;
}

.request-history-request > summary::marker {
  content: "";
}

.request-history-request > summary::before {
  align-items: center;
  background: var(--color-info-bg-subtle);
  border: 1px solid var(--color-info-fg);
  border-radius: 50%;
  color: var(--color-info-fg);
  content: ">";
  display: inline-flex;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  height: 24px;
  justify-content: center;
  line-height: 1;
  transition: transform var(--motion-duration-fast) var(--motion-ease-standard);
  width: 24px;
}

.request-history-request[open] > summary::before {
  transform: rotate(90deg);
}

.request-history-request > summary:hover {
  background: var(--color-info-bg-subtle);
}

.request-history-request > summary:focus-visible {
  outline: 2px solid var(--color-accent-strong);
  outline-offset: -2px;
}

.request-history-summary-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: flex-end;
}

.request-history-expand-label {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-xs);
  padding: 4px 10px;
  white-space: nowrap;
}

.request-history-request-body {
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
}

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

.request-actions {
  justify-content: flex-start;
}

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

.approval-form .date-input {
  min-height: 34px;
  width: 150px;
}

.export-history {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .topbar {
    align-items: flex-start;
    gap: var(--space-md);
  }

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

  .form-grid,
  .form-grid-4,
  .admin-split-grid,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .module-access-row {
    grid-template-columns: 1fr;
  }

  .myday-task-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .purchase-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-md);
  }

  .request-history-request > summary {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .request-history-summary-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}
