/* ==========================================================================
   components.css — Reusable UI Component Styles
   All visual tokens reference CSS custom properties from base.html.
   Uses the 4px spacing system (--space-1 through --space-8).
   ========================================================================== */

/* ══════════════════════════════════════════════════════════════════════════
   CARD
   ══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-visible);
}

/* Card — Sizes */
.card--sm {
  padding: var(--space-2);
}

.card--lg {
  padding: var(--space-4);
}

/* Card — Selected */
.card--selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Card — Status Variants */
.card--done {
  border-left: 3px solid var(--status-done);
}

.card--running {
  border-left: 3px solid var(--status-running);
}

.card--blocked {
  border-left: 3px solid var(--status-blocked);
}

.card--error {
  border-left: 3px solid var(--status-error);
  box-shadow: var(--shadow-error);
  background: var(--danger-dim);
}

.card--pending {
  border-left: 3px solid var(--status-pending);
}

.card--archived {
  border-left: 3px solid var(--status-archived);
  opacity: 0.75;
}

/* Card — Header */
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.card__title {
  font-size: var(--text-h3);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.card__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

/* Card — Body */
.card__body {
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════════════════
   BUTTON
   ══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 6px var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-body);
  font-weight: var(--font-medium);
  font-family: var(--font-sans);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), color var(--transition),
              transform var(--duration-instant) var(--ease-default);
  user-select: none;
  -webkit-user-select: none;
}

.btn:active:not(.btn--disabled) {
  transform: scale(0.97);
}

/* Button — Size Variants */
.btn--sm {
  padding: 4px var(--space-2);
  font-size: var(--text-body-sm);
  height: 28px;
}

.btn--md {
  height: 32px;
}

/* Button — Variants */
.btn--primary {
  background: var(--accent);
  color: var(--bg-root);
  border-color: transparent;
  font-weight: var(--font-semibold);
}

.btn--primary:hover:not(.btn--disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn--secondary {
  background: var(--btn-ghost-bg);
  color: var(--text-secondary);
  border-color: var(--border-standard);
}

.btn--secondary:hover:not(.btn--disabled) {
  background: var(--btn-ghost-hover-bg);
  border-color: var(--border-visible);
  color: var(--text-primary);
}

.btn--danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: transparent;
}

.btn--danger:hover:not(.btn--disabled) {
  background: var(--danger-hover-bg);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.btn--ghost {
  background: transparent;
  color: var(--text-tertiary);
  border-color: transparent;
}

.btn--ghost:hover:not(.btn--disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn--icon {
  background: transparent;
  color: var(--text-tertiary);
  border-color: transparent;
  padding: var(--space-1);
  min-width: 28px;
  min-height: 28px;
  border-radius: var(--radius-md);
}

.btn--icon:hover:not(.btn--disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Button — Disabled */
.btn--disabled,
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button — Loading */
.btn--loading {
  position: relative;
  cursor: wait;
  pointer-events: none;
}

.btn__spinner {
  display: inline-flex;
  align-items: center;
}

.btn__spinner-icon {
  animation: btn-spin 0.6s linear infinite;
}

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

/* Button — Icon slot */
.btn__icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.btn__icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Button — Label */
.btn__label {
  display: inline-block;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   INPUT
   ══════════════════════════════════════════════════════════════════════════ */
.input {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.input--sm .input__field {
  height: 28px;
  font-size: var(--text-body-sm);
  padding: 4px var(--space-2);
}

.input__label {
  font-size: var(--text-caption);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.input__required {
  color: var(--danger);
  margin-left: 2px;
}

.input__wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input__icon {
  position: absolute;
  left: var(--space-2);
  display: inline-flex;
  align-items: center;
  color: var(--text-quaternary);
  pointer-events: none;
  z-index: 1;
}

.input__icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.input__icon + .input__field {
  padding-left: calc(var(--space-2) + 20px);
}

.input__field {
  width: 100%;
  height: 32px;
  padding: 6px var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-body);
  font-family: var(--font-sans);
  line-height: 1.4;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input__field::placeholder {
  color: var(--text-quaternary);
}

.input__field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input__field:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.input__field:read-only {
  opacity: 0.75;
  cursor: default;
}

/* Input — Error State */
.input--error .input__field {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
}

.input--error .input__field:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input__error {
  font-size: var(--text-body-sm);
  color: var(--danger);
  margin: 0;
}

.input__help {
  font-size: var(--text-body-sm);
  color: var(--text-tertiary);
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   BADGE
   ══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-size: var(--text-caption);
  font-weight: var(--font-semibold);
  line-height: 1.2;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.badge--sm {
  font-size: 9px;
  padding: 1px 4px;
}

/* Badge — Semantic Status Colors */
.badge--done {
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-done);
  border-color: rgba(16, 185, 129, 0.25);
}

.badge--running {
  background: rgba(20, 184, 166, 0.12);
  color: var(--status-running);
  border-color: rgba(20, 184, 166, 0.25);
}

.badge--blocked {
  background: rgba(245, 158, 11, 0.12);
  color: var(--status-blocked);
  border-color: rgba(245, 158, 11, 0.25);
}

.badge--error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-error);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge--pending {
  background: var(--badge-neutral-bg);
  color: var(--status-pending);
  border-color: var(--border-standard);
}

.badge--archived {
  background: var(--badge-neutral-bg);
  color: var(--status-archived);
  border-color: var(--border-standard);
}

/* Badge — Custom Color Variants */
.badge--accent {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.25);
}

.badge--danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge--warn {
  background: var(--warn-dim);
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.25);
}

.badge--info {
  background: var(--info-dim);
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.25);
}

.badge--neutral {
  background: var(--badge-neutral-bg);
  color: var(--text-tertiary);
  border-color: var(--border-standard);
}

/* Badge — Dot Indicator */
.badge__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge__label {
  display: inline-block;
}

/* ══════════════════════════════════════════════════════════════════════════
   DROPDOWN
   ══════════════════════════════════════════════════════════════════════════ */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 6px var(--space-2);
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-body);
  font-family: var(--font-sans);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  user-select: none;
  -webkit-user-select: none;
}

.dropdown-trigger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-visible);
}

.dropdown-trigger__chevron {
  transition: transform var(--duration-fast) var(--ease-default);
}

.dropdown-wrapper[aria-expanded="true"] .dropdown-trigger__chevron,
.dropdown-trigger[aria-expanded="true"] .dropdown-trigger__chevron {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: var(--z-dropdown-menu);
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-1);
  display: none;
}

.dropdown-menu--right {
  left: auto;
  right: 0;
}

.dropdown-menu[hidden] {
  display: none;
}

.dropdown-menu:not([hidden]),
.dropdown-menu.open {
  display: block;
  animation: dropdown-enter var(--duration-fast) var(--ease-enter) both;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-body);
  font-family: var(--font-sans);
  font-weight: var(--font-regular);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  user-select: none;
  -webkit-user-select: none;
}

.dropdown-item:hover:not(.dropdown-item--disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

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

.dropdown-item--danger:hover:not(.dropdown-item--disabled) {
  background: var(--danger-dim);
  color: var(--danger);
}

.dropdown-item--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dropdown-item__icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-quaternary);
  width: 16px;
  height: 16px;
}

.dropdown-item__icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

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

.dropdown-item__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-1) 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   Reduced Motion
   ══════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .card,
  .btn,
  .input__field,
  .badge,
  .dropdown-menu,
  .dropdown-trigger,
  .dropdown-item,
  .dropdown-trigger__chevron {
    transition: none !important;
    animation: none !important;
  }

  .btn:active:not(.btn--disabled) {
    transform: none;
  }

  .btn__spinner-icon {
    animation: none !important;
  }

  @keyframes dropdown-enter {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   DATA TABLE
   ══════════════════════════════════════════════════════════════════════════ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

/* ── Table Caption (accessible label) ── */
.table__caption {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-body-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  text-align: left;
  caption-side: top;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Header ── */
.table thead {
  background: var(--bg-surface);
}

.table__header {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-caption);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  white-space: nowrap;
  user-select: none;
  border-bottom: 1px solid var(--border-subtle);
  transition: color var(--transition);
}

.table__header--right {
  text-align: right;
}

.table__header--center {
  text-align: center;
}

/* ── Sortable Header ── */
.table__header--sortable {
  cursor: pointer;
}

.table__header--sortable:hover {
  color: var(--text-primary);
}

.table__header--sortable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

.table__header-label {
  display: inline;
}

.table__sort-icon {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-1);
  vertical-align: middle;
  opacity: 0.3;
  transition: opacity var(--transition);
}

.table__header--sortable:hover .table__sort-icon,
.table__header--sorted-asc .table__sort-icon,
.table__header--sorted-desc .table__sort-icon {
  opacity: 0.7;
}

/* Sorted states — highlight the active direction */
.table__header--sorted-asc .table__sort-icon svg path:first-child {
  opacity: 1;
  color: var(--accent);
}

.table__header--sorted-desc .table__sort-icon svg path:last-child {
  opacity: 1;
  color: var(--accent);
}

/* ── Body Rows ── */
.table__row {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease-default);
  height: 36px;
}

.table__row:last-child {
  border-bottom: none;
}

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

/* ── Row — Semantic Status Colors ── */
.table__row--done {
  border-left: 3px solid var(--status-done);
}

.table__row--running {
  border-left: 3px solid var(--status-running);
}

.table__row--blocked {
  border-left: 3px solid var(--status-blocked);
}

.table__row--error {
  border-left: 3px solid var(--status-error);
  background: rgba(239, 68, 68, 0.04);
}

.table__row--pending {
  border-left: 3px solid var(--status-pending);
}

.table__row--archived {
  border-left: 3px solid var(--status-archived);
  opacity: 0.6;
}

/* ── Row — Selected ── */
.table__row--selected {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
}

/* ── Row — Clickable ── */
.table__row--clickable {
  cursor: pointer;
}

.table__row--clickable:hover {
  background: var(--bg-hover);
}

/* ── Cells ── */
.table__cell {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

.table__cell--right {
  text-align: right;
}

.table__cell--center {
  text-align: center;
}

/* ── Cell — Monospace ── */
.cell--mono {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  color: var(--text-primary);
}

/* ── Cell — Accent highlight ── */
.cell--accent {
  color: var(--accent);
  font-weight: var(--font-semibold);
}

/* ── Cell — Danger highlight ── */
.cell--danger {
  color: var(--danger);
}

/* ── Cell — Numeric (right-aligned, tabular) ── */
.cell--numeric {
  text-align: right;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* ── Empty State ── */
.table__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.table__empty-msg {
  font-size: var(--text-body);
  color: var(--text-tertiary);
}

/* ── Responsive: card-style tables on narrow screens ── */
@media (max-width: 767px) {
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table__row,
  .table__cell {
    display: block;
  }

  .table-responsive {
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .table__row {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
    padding: var(--space-2);
    height: auto;
    position: relative;
  }

  .table__row:last-child {
    margin-bottom: 0;
  }

  .table__cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-1) 0;
    white-space: normal;
    max-width: none;
    gap: var(--space-2);
  }

  .table__cell:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
  }

  .table__cell[data-label]:before {
    content: attr(data-label);
    font-size: var(--text-caption);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
  }

  /* Status border becomes a top accent on mobile */
  .table__row--done,
  .table__row--running,
  .table__row--blocked,
  .table__row--error,
  .table__row--pending,
  .table__row--archived,
  .table__row--selected {
    border-left-width: 1px;
  }

  .table__row--done { border-top: 3px solid var(--status-done); }
  .table__row--running { border-top: 3px solid var(--status-running); }
  .table__row--blocked { border-top: 3px solid var(--status-blocked); }
  .table__row--error { border-top: 3px solid var(--status-error); }
  .table__row--pending { border-top: 3px solid var(--status-pending); }
  .table__row--archived { border-top: 3px solid var(--status-archived); }
  .table__row--selected { border-top: 3px solid var(--accent); }
}

/* ── Compact Table Variant ── */
.table--compact .table__header {
  padding: var(--space-1) var(--space-2);
  font-size: 10px;
}

.table--compact .table__cell {
  padding: 2px var(--space-2);
  font-size: var(--text-body-sm);
}

.table--compact .table__row {
  height: 28px;
}

/* ══════════════════════════════════════════════════════════════════════════
   Utility Hover States — Transitional CSS for old mosaiq-* utility classes
   ══════════════════════════════════════════════════════════════════════════

   These provide hover/focus/group-hover states for elements that still
   reference pseudo-prefixed mosaiq classes (e.g. hover:text-mosaiq-text).
   New code should use CSS custom properties directly.
   ========================================================================= */

/* Text hover colors */
.hover\:text-mosaiq-text:hover { color: var(--text-primary); }
.hover\:text-mosaiq-muted:hover { color: var(--text-tertiary); }
.hover\:text-mosaiq-accent:hover { color: var(--accent); }

/* Background hover colors */
.hover\:bg-mosaiq-bg:hover { background: var(--bg-root); }
.hover\:bg-mosaiq-card:hover { background: var(--bg-surface); }
.hover\:bg-mosaiq-surface:hover { background: var(--bg-surface); }
.hover\:bg-mosaiq-elevated:hover { background: var(--bg-elevated); }
.hover\:bg-mosaiq-hover:hover { background: var(--bg-hover); }
.hover\:bg-mosaiq-panel:hover { background: var(--bg-surface); }
.hover\:bg-mosaiq-sink:hover { background: var(--bg-surface); }

/* Border hover colors */
.hover\:border-mosaiq-border:hover { border-color: var(--border-standard); }
.hover\:border-mosaiq-accent:hover { border-color: var(--accent); }

/* Group hover states */
.group-hover\:text-mosaiq-text:hover .group-hover\:text-mosaiq-text { color: var(--text-primary); }
.group-hover\:text-mosaiq-accent:hover .group-hover\:text-mosaiq-accent { color: var(--accent); }
.group-hover\:text-mosaiq-muted:hover .group-hover\:text-mosaiq-muted { color: var(--text-tertiary); }

/* Focus states */
.focus\:text-mosaiq-text:focus { color: var(--text-primary); }
.focus\:bg-mosaiq-bg:focus { background: var(--bg-root); }
.focus\:border-mosaiq-accent:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   ALERT — inline notification banners
   ══════════════════════════════════════════════════════════════════════════ */
.alert {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--text-body);
  margin-bottom: var(--space-3);
  border: 1px solid var(--border-subtle);
}

.alert--success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-done);
  border-color: rgba(16, 185, 129, 0.25);
}

.alert--error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-error);
  border-color: rgba(239, 68, 68, 0.25);
}

.alert--warn {
  background: rgba(245, 158, 11, 0.12);
  color: var(--status-blocked);
  border-color: rgba(245, 158, 11, 0.25);
}

.alert--info {
  background: rgba(96, 165, 250, 0.12);
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.25);
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE CONTAINER — standard page wrapper
   ══════════════════════════════════════════════════════════════════════════ */
.page-container {
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

/* ══════════════════════════════════════════════════════════════════════════
   SECTION TITLE — consistent h2 heading
   ══════════════════════════════════════════════════════════════════════════ */
.section-title {
  font-size: var(--text-h2);
  font-weight: var(--font-semibold);
}

/* ══════════════════════════════════════════════════════════════════════════
   DETAIL — property label/value pairs
   ══════════════════════════════════════════════════════════════════════════ */
.detail__label {
  color: var(--text-tertiary);
  font-size: var(--text-body);
}

.detail__value {
  color: var(--text-primary);
  font-size: var(--text-body);
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════════════════════ */
.pagination__info {
  padding: var(--space-1) var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--text-body);
}

/* ══════════════════════════════════════════════════════════════════════════
   CARD MODIFIERS — additional card variants
   ══════════════════════════════════════════════════════════════════════════ */
.card--empty {
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  padding: var(--space-8);
}

.card--sm-pad {
  padding: var(--space-4);
}

/* ══════════════════════════════════════════════════════════════════════════
   FILTER INPUT — compact filter bar input (replaces individual inline styles)
   ══════════════════════════════════════════════════════════════════════════ */
.filter-input {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-body);
  background: var(--bg-root);
  border: 1px solid var(--border-standard);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ══════════════════════════════════════════════════════════════════════════
   STEP CARD — pipeline step node
   ══════════════════════════════════════════════════════════════════════════ */
.step-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  opacity: 0.2;
  font-size: var(--text-body);
  font-weight: var(--font-semibold);
  color: var(--accent);
  flex-shrink: 0;
}

.step-connector {
  width: 2px;
  height: 48px;
  margin: var(--space-1) auto;
  background: var(--border-standard);
}

/* ══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY — standardized heading/body classes
   Replace inline `style="font-size:...;font-weight:...;color:..."` patterns
   ══════════════════════════════════════════════════════════════════════════ */
.page-title {
  font-size: var(--text-h1);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.text-h1 {
  font-size: var(--text-h1);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.text-h2 {
  font-size: var(--text-h2);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.text-h3 {
  font-size: var(--text-h3);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.text-body {
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.5;
}

.text-body-sm {
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

.text-caption {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: var(--font-medium);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  color: var(--text-tertiary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-tertiary {
  color: var(--text-tertiary);
}

.text-quaternary {
  color: var(--text-quaternary);
}

.text-accent {
  color: var(--accent);
}

.text-danger {
  color: var(--danger);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-mono {
  font-family: var(--font-mono);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

/* ══════════════════════════════════════════════════════════════════════════
   LAYOUT UTILITIES
   ══════════════════════════════════════════════════════════════════════════ */
.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-24 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.w-full { width: 100%; }
.max-w-4xl { max-width: 900px; }
.max-w-6xl { max-width: 1200px; }

.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

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

/* ══════════════════════════════════════════════════════════════════════════
   EMPTY STATE — centered empty/skeleton placeholder
   ══════════════════════════════════════════════════════════════════════════ */
.empty-state {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state p {
  margin-bottom: var(--space-4);
  font-size: var(--text-body);
}

/* ── Card sub-element classes (standalone usage outside .task-card) ── */
.card__id {
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  color: var(--text-quaternary);
  margin-bottom: 2px;
  line-height: 1.2;
}
.card__meta {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  align-items: center;
}
.card__quick-actions {
  margin-top: var(--space-1);
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-default);
}
.card:hover .card__quick-actions,
.card--sm:hover .card__quick-actions {
  opacity: 1;
}
.card__metrics {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--border-subtle);
  display: none;
}
