/* ==========================================================================
   CherryAI EAM — Design System Primitives v1.0
   PR #116d.1 — Foundational visual layer

   These styles assume tokens.css has loaded. Every value resolves to a CSS
   custom property — no hard-coded color or spacing outside of tokens.

   Primitives shipped in #116d.1a: DataCard, KPITile, StatusPill, Sparkline
   Reserved class names for #116d.1b: DataTable, EmptyState, SkeletonLoader,
                                       ContextDrawer, ButtonGroup, BrandChip
   ========================================================================== */

/* ==========================================================================
   1. DATA-CARD — universal luxury container
   ========================================================================== */

.ds-card {
  position: relative;
  background: var(--surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  padding: var(--density-card-padding);
  box-shadow: var(--shadow-card-luxe);
  transition:
    transform var(--dur-base) var(--ease-out-expo),
    box-shadow var(--dur-base) var(--ease-out-expo),
    border-color var(--dur-base) var(--ease-out-expo);
  overflow: hidden;
}

/* Soft inner top-edge highlight — Linear/Vercel signature */
.ds-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.10) 50%,
    transparent 100%
  );
  pointer-events: none;
}

html.dark .ds-card {
  background: linear-gradient(180deg, var(--bg-elevated-2, #131726) 0%, var(--bg-elevated-1, #0d101c) 100%);
  border-color: var(--border-secondary);
}

.ds-card[data-interactive="true"],
.ds-card.is-interactive {
  cursor: pointer;
}

.ds-card[data-interactive="true"]:hover,
.ds-card.is-interactive:hover {
  transform: var(--hover-lift-lg);
  box-shadow: var(--shadow-card-luxe-hover);
  border-color: var(--border-strong);
}

/* Tone variants apply a colored ring + glow on the card */
.ds-card[data-tone="critical"] {
  border-color: rgba(239, 68, 72, 0.30);
}
.ds-card[data-tone="critical"].is-interactive:hover,
.ds-card[data-tone="critical"][data-interactive="true"]:hover {
  border-color: rgba(239, 68, 72, 0.55);
  box-shadow: var(--shadow-card-luxe-hover), var(--glow-critical);
}

.ds-card[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.28);
}
.ds-card[data-tone="warning"].is-interactive:hover,
.ds-card[data-tone="warning"][data-interactive="true"]:hover {
  border-color: rgba(245, 158, 11, 0.52);
  box-shadow: var(--shadow-card-luxe-hover), var(--glow-warning);
}

.ds-card[data-tone="success"] {
  border-color: rgba(16, 185, 129, 0.25);
}
.ds-card[data-tone="success"].is-interactive:hover,
.ds-card[data-tone="success"][data-interactive="true"]:hover {
  border-color: rgba(16, 185, 129, 0.48);
  box-shadow: var(--shadow-card-luxe-hover), var(--glow-success);
}

/* DataCard internal layout slots */
.ds-card__eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ds-card__eyebrow-label {
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.ds-card__title {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-700);
  font-size: var(--font-size-18);
  letter-spacing: -0.015em;
  color: var(--text-primary);
  line-height: var(--line-height-snug);
}
.ds-card__subtitle {
  font-size: var(--font-size-12);
  color: var(--text-secondary);
  margin-top: 4px;
}
.ds-card__body {
  margin-top: 12px;
}
.ds-card__footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-12);
  color: var(--text-muted);
}

/* Image-left variant: 4:5 aspect imagery, content right */
.ds-card--image-left .ds-card__inner {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
}
.ds-card--image-left .ds-card__image {
  position: relative;
  aspect-ratio: 4 / 5;
  background: linear-gradient(135deg, #1a1f33 0%, #0d101c 100%);
  overflow: hidden;
  border-right: 1px solid var(--border-secondary);
}
.ds-card--image-left .ds-card__image-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.ds-card--image-left .ds-card__body {
  padding: 18px 20px 20px;
  margin-top: 0;
}

/* Glass-blur floating badge over the image */
.ds-card__floating-badge {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-tint-dark-strong);
  backdrop-filter: var(--glass-blur-md);
  -webkit-backdrop-filter: var(--glass-blur-md);
  padding: 6px 10px 6px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-600);
  letter-spacing: 0.04em;
  color: #fff;
}
html.dark .ds-card__floating-badge {
  background: var(--glass-tint-dark-strong);
}
:root:not(.dark) .ds-card__floating-badge {
  background: var(--glass-tint-light-strong);
  color: var(--text-primary);
  border-color: var(--border-secondary);
}

.ds-card__floating-badge--top-left { top: 14px; left: 14px; }
.ds-card__floating-badge--top-right { top: 14px; right: 14px; }
.ds-card__floating-badge--bottom-left { bottom: 14px; left: 14px; }
.ds-card__floating-badge--bottom-right { bottom: 14px; right: 14px; }

/* AI-storyline pinned narrative inside the card */
.ds-card__storyline {
  font-size: var(--font-size-12);
  color: var(--text-secondary);
  line-height: var(--line-height-snug);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 91, 91, 0.06);
  border-left: 2px solid var(--danger);
}
.ds-card[data-tone="warning"] .ds-card__storyline {
  background: rgba(245, 158, 11, 0.06);
  border-left-color: var(--warning);
}
.ds-card[data-tone="success"] .ds-card__storyline {
  background: rgba(16, 185, 129, 0.05);
  border-left-color: var(--success);
}


/* ==========================================================================
   2. KPI-TILE — number + label + delta + sparkline
   ========================================================================== */

.ds-kpi {
  position: relative;
  background: var(--surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  padding: var(--density-card-padding);
  overflow: hidden;
  box-shadow: var(--shadow-card-luxe);
  transition:
    transform var(--dur-base) var(--ease-out-expo),
    box-shadow var(--dur-base) var(--ease-out-expo),
    border-color var(--dur-base) var(--ease-out-expo);
  cursor: pointer;
  min-height: 130px;
}

html.dark .ds-kpi {
  background: linear-gradient(180deg, var(--bg-elevated-2, #131726) 0%, var(--bg-elevated-1, #0d101c) 100%);
}

.ds-kpi:hover {
  transform: var(--hover-lift-md);
  box-shadow: var(--shadow-card-luxe-hover);
  border-color: var(--border-strong);
}

.ds-kpi__label {
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.ds-kpi__value {
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 1;
  font-weight: var(--font-weight-700);
  font-size: var(--font-size-32);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-top: 10px;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}

.ds-kpi__value-unit {
  font-size: var(--font-size-18);
  font-weight: var(--font-weight-500);
  color: var(--text-muted);
  margin-left: 4px;
}

/* Numeric utility (Aurora Wave 0) — tabular, luxury-tracked numerals.
   Never monospace: Inter + tnum/cv11 keeps columns aligned without the
   cash-register look. (.num is claimed by legacy scoped rules in modern.css
   and cockpit-v2.css — hence the ds- namespace.) */
.ds-num {
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 1, "cv11" 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.012em;
}
.ds-num--display {
  font-weight: var(--font-weight-700);
  letter-spacing: -0.025em;
}

.ds-kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-500);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  position: relative;
  z-index: 1;
}
.ds-kpi__delta--up    { color: var(--success); background: var(--success-soft); }
.ds-kpi__delta--down  { color: var(--danger);  background: var(--danger-soft); }
.ds-kpi__delta--flat  { color: var(--text-muted); background: rgba(0,0,0,0.04); }
html.dark .ds-kpi__delta--flat { background: rgba(255,255,255,0.05); }

.ds-kpi__spark {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  pointer-events: none;
  opacity: 0.85;
  z-index: 0;
}


/* ==========================================================================
   3. STATUS-PILL — semantic tone matrix
   ========================================================================== */

.ds-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-500);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--dur-quick) var(--ease-out-expo), border-color var(--dur-quick) var(--ease-out-expo);
}

.ds-pill__dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
}

.ds-pill[data-tone="neutral"] {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--border-secondary);
  color: var(--text-secondary);
}
html.dark .ds-pill[data-tone="neutral"] { background: rgba(255, 255, 255, 0.05); }
.ds-pill[data-tone="neutral"] .ds-pill__dot { background: var(--text-muted); }

.ds-pill[data-tone="success"], .ds-pill[data-tone="active"] {
  background: var(--success-soft);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--color-success-700);
}
html.dark .ds-pill[data-tone="success"], html.dark .ds-pill[data-tone="active"] { color: var(--ink-on-success-tint); }
.ds-pill[data-tone="success"] .ds-pill__dot, .ds-pill[data-tone="active"] .ds-pill__dot {
  background: var(--success); box-shadow: 0 0 8px var(--glow-success);
}

.ds-pill[data-tone="warning"] {
  background: var(--warning-soft);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--color-warning-700);
}
html.dark .ds-pill[data-tone="warning"] { color: var(--ink-on-warning-tint); }
.ds-pill[data-tone="warning"] .ds-pill__dot {
  background: var(--warning); box-shadow: 0 0 8px var(--glow-warning);
}

.ds-pill[data-tone="danger"], .ds-pill[data-tone="critical"] {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.30);
  color: var(--color-danger-700);
}
html.dark .ds-pill[data-tone="danger"], html.dark .ds-pill[data-tone="critical"] { color: var(--ink-on-danger-tint); }
.ds-pill[data-tone="danger"] .ds-pill__dot, .ds-pill[data-tone="critical"] .ds-pill__dot {
  background: var(--danger); box-shadow: 0 0 8px var(--glow-critical);
}

.ds-pill[data-tone="info"] {
  background: var(--info-soft);
  border-color: rgba(59, 130, 246, 0.25);
  color: var(--color-info-700);
}
html.dark .ds-pill[data-tone="info"] { color: var(--ink-on-info-tint); }
.ds-pill[data-tone="info"] .ds-pill__dot { background: var(--info); }

.ds-pill[data-tone="brand"] {
  background: var(--color-accent-soft);
  border-color: rgba(207, 51, 57, 0.30);
  color: var(--color-accent);
}
.ds-pill[data-tone="brand"] .ds-pill__dot {
  background: var(--color-accent); box-shadow: 0 0 8px var(--color-accent-glow);
}

.ds-pill[data-tone="muted"] {
  background: transparent;
  border-color: var(--border-secondary);
  color: var(--text-muted);
}
.ds-pill[data-tone="muted"] .ds-pill__dot { background: var(--text-muted); }

/* Optional mono numeric — sized down */
.ds-pill__num {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-weight: var(--font-weight-600);
  font-size: var(--font-size-11);
}


/* ==========================================================================
   4. SPARKLINE — inline SVG helper
   ========================================================================== */

.ds-spark {
  display: block;
  width: 100%;
  height: 100%;
}

.ds-spark__line {
  fill: none;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ds-spark__area {
  fill: currentColor;
  opacity: 0.18;
}

.ds-spark[data-tone="success"] { color: var(--success); }
.ds-spark[data-tone="warning"] { color: var(--warning); }
.ds-spark[data-tone="danger"]  { color: var(--danger); }
.ds-spark[data-tone="critical"] { color: var(--danger); }
.ds-spark[data-tone="info"]    { color: var(--info); }
.ds-spark[data-tone="muted"]   { color: var(--text-muted); }
.ds-spark[data-tone="brand"]   { color: var(--color-accent); }

.ds-spark[data-tone="success"] .ds-spark__line,
.ds-spark[data-tone="warning"] .ds-spark__line,
.ds-spark[data-tone="danger"]  .ds-spark__line,
.ds-spark[data-tone="critical"] .ds-spark__line,
.ds-spark[data-tone="info"]    .ds-spark__line,
.ds-spark[data-tone="muted"]   .ds-spark__line,
.ds-spark[data-tone="brand"]   .ds-spark__line {
  stroke: currentColor;
}


/* ==========================================================================
   5. SHOWCASE PAGE LAYOUT (used by /Admin/DesignSystem)
   ========================================================================== */

.ds-showcase {
  padding: var(--density-page-padding);
  max-width: 1280px;
  margin: 0 auto;
}

.ds-showcase__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 36px;
}

.ds-showcase__title {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-700);
  font-size: var(--font-size-32);
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
}

.ds-showcase__subtitle {
  font-size: var(--font-size-14);
  color: var(--text-secondary);
  margin-top: 8px;
  max-width: 640px;
  line-height: 1.5;
}

.ds-showcase__section {
  margin-bottom: var(--density-section-gap);
}

.ds-showcase__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.ds-showcase__section-title {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-600);
  font-size: var(--font-size-18);
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.ds-showcase__section-meta {
  font-size: var(--font-size-12);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ds-showcase__grid {
  display: grid;
  gap: var(--density-card-gap);
}

.ds-showcase__grid--2 { grid-template-columns: repeat(2, 1fr); }
.ds-showcase__grid--3 { grid-template-columns: repeat(3, 1fr); }
.ds-showcase__grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .ds-showcase__grid--4 { grid-template-columns: repeat(2, 1fr); }
  .ds-showcase__grid--3 { grid-template-columns: 1fr; }
}

/* Density toggle (sits at top-right of showcase) */
.ds-density-toggle {
  display: inline-flex;
  background: var(--surface-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.ds-density-toggle__btn {
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-500);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-quick) var(--ease-out-expo);
  font-family: inherit;
}
.ds-density-toggle__btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}
html.dark .ds-density-toggle__btn:hover { background: rgba(255, 255, 255, 0.05); }
.ds-density-toggle__btn[aria-pressed="true"] {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--glow-brand);
}


/* ==========================================================================
   6. CANVAS NOISE TEXTURE (subtle film grain — sits behind cards)
   Wire up via <canvas id="ds-noise"> + primitives.js
   ========================================================================== */
.ds-noise-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.025;
  mix-blend-mode: overlay;
}
@media (prefers-reduced-motion: reduce) {
  .ds-noise-canvas { display: none; }
}

/* ==========================================================================
   PR #116d.1b — Six more primitives
   DataTable · EmptyState v2 · SkeletonLoader · ContextDrawer · ButtonGroup · BrandChip
   ========================================================================== */

/* ==========================================================================
   7. DATA-TABLE — sortable, sticky-header, density-aware
   ========================================================================== */

.ds-table {
  background: var(--surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card-luxe);
  overflow: hidden;
  position: relative;
}
html.dark .ds-table {
  background: linear-gradient(180deg, var(--bg-elevated-2, #131726) 0%, var(--bg-elevated-1, #0d101c) 100%);
}
.ds-table__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border-secondary);
  gap: 16px;
}
.ds-table__title {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-600);
  font-size: var(--font-size-18);
  letter-spacing: -0.015em;
  color: var(--text-primary);
}
.ds-table__count {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-size: var(--font-size-12);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-secondary);
  border: 1px solid var(--border-secondary);
}
.ds-table__scroll {
  overflow: auto;
  max-height: 70vh;
  /* keyboard cursors (eq-cockpit roving focus) must never scroll a focused
     row under the sticky thead (WCAG 2.4.11) */
  scroll-padding-top: 44px;
}
.ds-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--font-size-13);
}
.ds-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-secondary);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  font-weight: var(--font-weight-600);
  font-size: var(--font-size-11);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-secondary);
  text-align: left;
  white-space: nowrap;
}
.ds-table thead th[data-sortable="true"] {
  cursor: pointer;
  user-select: none;
}
.ds-table thead th[data-sortable="true"]:hover { color: var(--text-primary); }
.ds-table thead th[data-sortable="true"] span { display: inline-flex; align-items: center; gap: 6px; }
.ds-table__sort {
  opacity: 0.5;
  transition: opacity var(--dur-quick) var(--ease-out-expo);
}
.ds-table thead th[data-sortable="true"]:hover .ds-table__sort { opacity: 1; }

.ds-table tbody td {
  padding: 0 16px;
  height: var(--density-row-height);
  border-bottom: 1px solid var(--border-secondary);
  color: var(--text-primary);
  vertical-align: middle;
}
.ds-table tbody tr {
  transition: background var(--dur-quick) var(--ease-out-expo);
}
.ds-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.025);
}
html.dark .ds-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.ds-table tbody tr:last-child td { border-bottom: 0; }
.ds-table__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px !important;
  font-style: italic;
  height: auto !important;
}

/* ==========================================================================
   8. EMPTY-STATE V2 — hero + headline + body + CTA
   ========================================================================== */

.ds-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 56px 32px 64px;
  background: var(--surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card-luxe);
}
html.dark .ds-empty {
  background: linear-gradient(180deg, var(--bg-elevated-2, #131726) 0%, var(--bg-elevated-1, #0d101c) 100%);
}
.ds-empty__icon-wrap {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-secondary);
  color: var(--text-muted);
  transition: transform var(--dur-base) var(--ease-out-expo);
}
html.dark .ds-empty__icon-wrap {
  background: rgba(255, 255, 255, 0.03);
}
.ds-empty[data-tone="success"] .ds-empty__icon-wrap { color: var(--success); background: var(--success-soft); border-color: rgba(16,185,129,0.25); box-shadow: var(--glow-success); }
.ds-empty[data-tone="warning"] .ds-empty__icon-wrap { color: var(--warning); background: var(--warning-soft); border-color: rgba(245,158,11,0.25); box-shadow: var(--glow-warning); }
.ds-empty[data-tone="danger"] .ds-empty__icon-wrap,
.ds-empty[data-tone="critical"] .ds-empty__icon-wrap { color: var(--danger); background: var(--danger-soft); border-color: rgba(239,68,68,0.25); box-shadow: var(--glow-critical); }
.ds-empty[data-tone="info"] .ds-empty__icon-wrap { color: var(--info); background: var(--info-soft); border-color: rgba(59,130,246,0.25); }
.ds-empty[data-tone="brand"] .ds-empty__icon-wrap { color: var(--color-accent); background: var(--color-accent-soft); border-color: rgba(207,51,57,0.25); box-shadow: var(--glow-brand); }

.ds-empty__icon-wrap svg { width: 36px; height: 36px; }
.ds-empty:hover .ds-empty__icon-wrap { transform: translateY(-1px); }
.ds-empty__title {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-600);
  font-size: var(--font-size-18);
  letter-spacing: -0.015em;
  color: var(--text-primary);
}
.ds-empty__body {
  font-size: var(--font-size-14);
  color: var(--text-secondary);
  line-height: var(--line-height-snug);
  max-width: 420px;
}
.ds-empty__actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ==========================================================================
   9. SKELETON-LOADER — animated placeholder shapes
   ========================================================================== */

@keyframes ds-skel-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ds-skel {
  position: relative;
  background: var(--surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  padding: var(--density-card-padding);
  overflow: hidden;
}
html.dark .ds-skel {
  background: linear-gradient(180deg, var(--bg-elevated-2, #131726) 0%, var(--bg-elevated-1, #0d101c) 100%);
}
.ds-skel__shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
  animation: ds-skel-shimmer 1.6s var(--ease-in-out-quint) infinite;
  pointer-events: none;
  z-index: 1;
}
:root:not(.dark) .ds-skel__shimmer {
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.04) 50%, transparent 100%);
}
.ds-skel__line {
  height: 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  margin: 8px 0;
}
html.dark .ds-skel__line { background: rgba(255, 255, 255, 0.06); }
.ds-skel__line--sm { height: 8px; }
.ds-skel__line--lg { height: 18px; }
.ds-skel__line--xl { height: 32px; border-radius: 8px; }
.ds-skel__line--w15 { width: 15%; }
.ds-skel__line--w20 { width: 20%; }
.ds-skel__line--w30 { width: 30%; }
.ds-skel__line--w40 { width: 40%; }
.ds-skel__line--w50 { width: 50%; }
.ds-skel__line--w60 { width: 60%; }
.ds-skel__line--w70 { width: 70%; }
.ds-skel__line--w80 { width: 80%; }
.ds-skel__line--w90 { width: 90%; }

.ds-skel--card { min-height: 160px; }
.ds-skel--table { padding: 0; }
.ds-skel--table .ds-skel__row {
  display: grid;
  grid-template-columns: 1fr 2fr 1.4fr 0.8fr;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-secondary);
}
.ds-skel--table .ds-skel__row:last-child { border-bottom: 0; }
.ds-skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--density-card-gap);
}
.ds-skel--kpi { min-height: 130px; }

@media (prefers-reduced-motion: reduce) {
  .ds-skel__shimmer { animation: none; }
}

/* ==========================================================================
   10. CONTEXT-DRAWER — slide-in right drawer
   ========================================================================== */

.ds-drawer {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  /* visibility rides the fade with a delayed flip on close — opacity alone
     leaves the closed drawer's controls in the Tab order (aria-hidden-focus). */
  visibility: hidden;
  /* clip the panel's translateX(100%) off-screen (closed) + mid-slide states so
     they never extend document scrollWidth into a phantom horizontal scrollbar.
     Under a transformed ancestor (_ModernLayout .page-content has translateY),
     this fixed element becomes a scroll contributor; the OPEN panel is always
     within the viewport, so nothing visible is clipped. */
  overflow: hidden;
  transition: opacity var(--dur-base) var(--ease-out-expo),
              visibility 0s linear var(--dur-base);
}
.ds-drawer[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition-delay: 0s;
}
.ds-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
}
.ds-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  max-width: 96vw;
  background: var(--surface-primary);
  border-left: 1px solid var(--border-secondary);
  box-shadow: var(--shadow-elevation-5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-relaxed) var(--ease-emphasized);
  overflow: hidden;
}
html.dark .ds-drawer__panel {
  background: linear-gradient(180deg, var(--bg-elevated-2, #131726) 0%, var(--bg-elevated-1, #0d101c) 100%);
}
.ds-drawer[aria-hidden="false"] .ds-drawer__panel {
  transform: translateX(0);
}
.ds-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-secondary);
  gap: 16px;
}
.ds-drawer__title {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-700);
  font-size: var(--font-size-20);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.ds-drawer__subtitle {
  font-size: var(--font-size-13);
  color: var(--text-secondary);
  margin-top: 4px;
}
.ds-drawer__close {
  appearance: none;
  background: var(--surface-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--dur-quick) var(--ease-out-expo);
}
.ds-drawer__close:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: scale(1.05);
}
.ds-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.ds-drawer__foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-secondary);
}

/* ==========================================================================
   11. BUTTON-GROUP — variants × sizes
   ========================================================================== */

.ds-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ds-btn-group--center { justify-content: center; }
.ds-btn-group--end { justify-content: flex-end; }
.ds-btn-group--start { justify-content: flex-start; }

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: var(--font-weight-500);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform var(--dur-quick) var(--ease-out-expo),
    background var(--dur-quick) var(--ease-out-expo),
    border-color var(--dur-quick) var(--ease-out-expo),
    box-shadow var(--dur-quick) var(--ease-out-expo),
    color var(--dur-quick) var(--ease-out-expo);
}
.ds-btn:active { transform: var(--click-press); }
.ds-btn:focus-visible { outline: 0; box-shadow: var(--ring-focus-visible); }

.ds-btn--sm { font-size: var(--font-size-12); padding: 6px 10px; height: 28px; }
.ds-btn--md { font-size: var(--font-size-13); padding: 9px 14px; height: 36px; }
.ds-btn--lg { font-size: var(--font-size-14); padding: 11px 18px; height: 42px; }

.ds-btn--primary {
  background: linear-gradient(180deg, #f1525a 0%, #c92429 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(207, 51, 57, 0.30);
}
.ds-btn--primary:hover {
  transform: var(--hover-lift-sm);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 4px 14px rgba(207, 51, 57, 0.40),
    0 8px 24px rgba(207, 51, 57, 0.20);
}

.ds-btn--secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-elevation-1);
}
.ds-btn--secondary:hover {
  transform: var(--hover-lift-sm);
  background: var(--surface-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-elevation-2);
}
html.dark .ds-btn--secondary {
  background: var(--bg-elevated-2, #131726);
}
html.dark .ds-btn--secondary:hover {
  background: var(--bg-elevated-3, #1a1f33);
}

.ds-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.ds-btn--ghost:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}
html.dark .ds-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ds-btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 2px 8px rgba(239, 68, 68, 0.30);
}
.ds-btn--danger:hover {
  transform: var(--hover-lift-sm);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 14px rgba(239, 68, 68, 0.40);
}

.ds-btn.is-disabled,
.ds-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   12. BRAND-CHIP — per-OEM color accent
   ========================================================================== */

.ds-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-secondary);
  background: var(--surface-secondary);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-500);
  line-height: 1;
  white-space: nowrap;
}
.ds-brand-chip--sm { font-size: var(--font-size-11); padding: 3px 8px; }
.ds-brand-chip--md { font-size: var(--font-size-12); padding: 4px 10px; }
.ds-brand-chip--lg { font-size: var(--font-size-13); padding: 6px 14px; }

.ds-brand-chip__dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.ds-brand-chip__mfr { font-weight: var(--font-weight-600); }
.ds-brand-chip__model {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  color: var(--text-muted);
}

/* Per-OEM color overrides — dot + soft tint */
.ds-brand-chip--haas      { background: rgba(207, 51, 57, 0.10);  border-color: rgba(207, 51, 57, 0.30);  color: #c92429; }
.ds-brand-chip--haas      .ds-brand-chip__dot { background: #cf3339; box-shadow: 0 0 8px rgba(207,51,57,0.4); }
.ds-brand-chip--mazak     { background: rgba(234, 179, 8, 0.10);  border-color: rgba(234, 179, 8, 0.30);  color: #a16207; }
.ds-brand-chip--mazak     .ds-brand-chip__dot { background: #eab308; box-shadow: 0 0 8px rgba(234,179,8,0.4); }
.ds-brand-chip--lincoln   { background: rgba(220, 38, 38, 0.10);  border-color: rgba(220, 38, 38, 0.30);  color: #b91c1c; }
.ds-brand-chip--lincoln   .ds-brand-chip__dot { background: #dc2626; box-shadow: 0 0 8px rgba(220,38,38,0.4); }
.ds-brand-chip--kuka      { background: rgba(255, 140, 30, 0.12); border-color: rgba(255, 140, 30, 0.35); color: #c2410c; }
.ds-brand-chip--kuka      .ds-brand-chip__dot { background: #ff8c1e; box-shadow: 0 0 8px rgba(255,140,30,0.4); }
.ds-brand-chip--fanuc     { background: rgba(250, 204, 21, 0.12); border-color: rgba(250, 204, 21, 0.32); color: #854d0e; }
.ds-brand-chip--fanuc     .ds-brand-chip__dot { background: #facc15; box-shadow: 0 0 8px rgba(250,204,21,0.4); }
.ds-brand-chip--trumpf    { background: rgba(59, 130, 246, 0.10); border-color: rgba(59, 130, 246, 0.30); color: #1d4ed8; }
.ds-brand-chip--trumpf    .ds-brand-chip__dot { background: #3b82f6; box-shadow: 0 0 8px rgba(59,130,246,0.4); }
.ds-brand-chip--dmgmori   { background: rgba(16, 185, 129, 0.10); border-color: rgba(16, 185, 129, 0.30); color: #047857; }
.ds-brand-chip--dmgmori   .ds-brand-chip__dot { background: #10b981; box-shadow: 0 0 8px rgba(16,185,129,0.4); }
.ds-brand-chip--schuler   { background: rgba(30, 64, 175, 0.10);  border-color: rgba(30, 64, 175, 0.30);  color: #1e40af; }
.ds-brand-chip--schuler   .ds-brand-chip__dot { background: #1e40af; box-shadow: 0 0 8px rgba(30,64,175,0.4); }
.ds-brand-chip--abb       { background: rgba(220, 38, 38, 0.10);  border-color: rgba(220, 38, 38, 0.30);  color: #b91c1c; }
.ds-brand-chip--abb       .ds-brand-chip__dot { background: #dc2626; box-shadow: 0 0 8px rgba(220,38,38,0.4); }
.ds-brand-chip--yaskawa   { background: rgba(37, 99, 235, 0.10);  border-color: rgba(37, 99, 235, 0.30);  color: #1d4ed8; }
.ds-brand-chip--yaskawa   .ds-brand-chip__dot { background: #2563eb; box-shadow: 0 0 8px rgba(37,99,235,0.4); }
.ds-brand-chip--atlas     { background: rgba(245, 158, 11, 0.10); border-color: rgba(245, 158, 11, 0.30); color: #92400e; }
.ds-brand-chip--atlas     .ds-brand-chip__dot { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.4); }
.ds-brand-chip--fronius   { background: rgba(220, 38, 38, 0.10);  border-color: rgba(220, 38, 38, 0.30);  color: #b91c1c; }
.ds-brand-chip--fronius   .ds-brand-chip__dot { background: #dc2626; box-shadow: 0 0 8px rgba(220,38,38,0.4); }
.ds-brand-chip--siemens   { background: rgba(13, 148, 136, 0.10); border-color: rgba(13, 148, 136, 0.30); color: #0f766e; }
.ds-brand-chip--siemens   .ds-brand-chip__dot { background: #0d9488; box-shadow: 0 0 8px rgba(13,148,136,0.4); }
.ds-brand-chip--doosan    { background: rgba(30, 58, 138, 0.10);  border-color: rgba(30, 58, 138, 0.30);  color: #1e3a8a; }
.ds-brand-chip--doosan    .ds-brand-chip__dot { background: #1e3a8a; box-shadow: 0 0 8px rgba(30,58,138,0.4); }
.ds-brand-chip--neutral   .ds-brand-chip__dot { background: var(--text-muted); }

/* dark-mode text overrides — the soft tint backgrounds already work well */
html.dark .ds-brand-chip--haas { color: #ff8b8e; }
html.dark .ds-brand-chip--mazak { color: #fde68a; }
html.dark .ds-brand-chip--lincoln { color: #fca5a5; }
html.dark .ds-brand-chip--kuka { color: #fdba74; }
html.dark .ds-brand-chip--fanuc { color: #fde047; }
html.dark .ds-brand-chip--trumpf { color: #93c5fd; }
html.dark .ds-brand-chip--dmgmori { color: #6ee7b7; }
html.dark .ds-brand-chip--schuler { color: #93c5fd; }
html.dark .ds-brand-chip--abb { color: #fca5a5; }
html.dark .ds-brand-chip--yaskawa { color: #93c5fd; }
html.dark .ds-brand-chip--atlas { color: #fcd34d; }
html.dark .ds-brand-chip--fronius { color: #fca5a5; }
html.dark .ds-brand-chip--siemens { color: #5eead4; }
html.dark .ds-brand-chip--doosan { color: #93c5fd; }

/* =============================================================================
   E&Q COCKPIT (Aurora Wave 0.3) — row cursor + recalc-flash + kbd hint.
   Consumed by eq-cockpit.js; extracted to eq-cockpit.css in Wave 2.1.
   ============================================================================= */

/* Row cursor: selection IS DOM focus (roving tabindex on native <tr>).
   :focus-within — not :focus-visible (Safari's heuristic is unreliable on
   programmatic .focus()) and not bare :focus (the highlight must survive when
   focus moves into a future inline cell editor). Neutral raised surface —
   red fills stay reserved for edit/error states. */
[data-eq-row]:focus-within {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px; /* inward — the dense tables clip outward outlines */
  box-shadow: inset 3px 0 0 var(--color-accent);
  background: var(--surface-secondary);
}

/* Recalc-flash: instant attack, slow decay — causality cue for a value that
   just changed. Tint is per-tone via a custom prop the keyframe reads.
   Reduced motion: --dur-flash is zeroed on the token rail, and eq-cockpit.js
   swaps to .eq-flash--static (a held tint, no animation) — information parity. */
.eq-flash {
  --eq-flash-tint: var(--margin-warn-bg);
  animation: eq-flash-decay var(--dur-flash) var(--ease-out-quart);
}
.eq-flash--neutral { --eq-flash-tint: var(--surface-secondary); }
.eq-flash--danger  { --eq-flash-tint: var(--danger-soft); }
.eq-flash--static  { animation: none; background-color: var(--eq-flash-tint); }
/* the held tint must also win on the currently-focused row (its :focus-within
   background otherwise out-specifies the single-class static rule) */
[data-eq-row].eq-flash--static:focus-within { background-color: var(--eq-flash-tint); }
@keyframes eq-flash-decay {
  0%   { background-color: var(--eq-flash-tint); }
  100% { background-color: transparent; }
}

/* Per-cell write-through state markers (consumer: Wave 2.2 editable grid;
   contract pinned by the 0.3 spec). */
[data-eq-pending] { opacity: 0.6; }
[data-eq-error]   { box-shadow: inset 0 0 0 1px var(--danger); }

/* Keyboard-hint line under an annotated grid. Discoverability, not chrome —
   Wave 4.3's '?' sheet supersedes it. kbd is EXPLICITLY sans: no cash-register
   numerals anywhere, including key chips (non-negotiable #8). */
.eq-kbd-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.eq-kbd-hint kbd {
  font-family: var(--font-sans);
  font-size: 10.5px;
  background: var(--surface-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-secondary);
}

/* =============================================================================
   E&Q QUOTE LIST (Aurora Wave 1.1) — page scaffold, filter chips, margin cell,
   skeleton rows, create drawer form. Extracted to eq-cockpit.css in Wave 2.1.
   ============================================================================= */

.eq-quotes-page {
  /* 1500px since Aurora 1.2 (the mockup .app width): the saved-views rail +
     grid can't share 1240px without re-enabling the inner table scroll the
     1.1 scroll-restore design deliberately opted out of. */
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 22px;
}
.eq-page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.eq-crumbs {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.eq-crumbs a { color: inherit; }
.eq-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.eq-page-head h1 {
  font-size: 22px;
  font-weight: var(--font-weight-700);
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-primary);
}
.eq-page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* PRG flash banners on the semantic tint + ink rail (retokenized from Q2's
   raw hex; also the page's data-eq-flash consumer for error-path redirects). */
.eq-banner {
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 13px;
}
.eq-banner--success { background: var(--success-soft); color: var(--ink-on-success-tint); }
.eq-banner--danger  { background: var(--danger-soft);  color: var(--ink-on-danger-tint); }

/* Status filter chips — GET links, server-side narrowing (mockup .qb idiom). */
.eq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 12px;
}
.eq-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  padding: 3px 9px;
  text-decoration: none;
  transition: background var(--dur-quick) var(--ease-out-quart),
              border-color var(--dur-quick) var(--ease-out-quart);
}
.eq-chip:hover { background: var(--surface-tertiary); }
.eq-chip:focus-visible {
  /* a real outline (light-mode --color-focus-ring-strong is 0.15α ≈ 1.1:1 —
     the soft ring alone fails the 3:1 focus-indicator floor) */
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  box-shadow: var(--ring-focus-visible);
}
.eq-chip .ds-num { color: var(--text-muted); }
.eq-chip .eq-chip__zero { opacity: 0.45; }
.eq-chip[aria-current="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--ink-on-accent-tint);
  font-weight: var(--font-weight-600);
}
.eq-chip[aria-current="true"] .ds-num { color: inherit; }

/* Quote-list card: this page keeps page-level scroll (Back-position restore
   reads window.scrollY) and today's non-sticky flow — the stock 70vh inner
   scroll container is opted out. */
.eq-quote-list .ds-table__scroll {
  max-height: none;
  overflow: visible;
}
/* No scroll container ⇒ the document scrolls; scroll-margin keeps a focused
   row clear of the sticky app header (WCAG 2.4.11), and the thead falls back
   to normal flow (sticky would pin it invisibly under the header). */
.eq-quote-list [data-eq-row] {
  scroll-margin-top: 112px;
  scroll-margin-bottom: 8px;
}
.eq-quote-list thead th { position: static; }
.eq-quote-list tbody td { vertical-align: middle; }

/* Two-line stacked cells (mockup .pn/.pdesc idiom). */
.eq-cell-main {
  font-size: 13px;
  color: var(--text-primary);
}
.eq-cell-link {
  font-weight: var(--font-weight-600);
  text-decoration: none;
}
.eq-cell-sub,
.eq-cell-sub-inline {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* width caps live on the inner BLOCKS — max-width on a td is ignored in
   auto table layout, and without a cap a nowrap sub-line's min-content
   width (free-text Scenario / Project·RFQ) forces horizontal body scroll */
.eq-cell-sub { margin-top: 1px; max-width: 300px; }
.eq-quote-list .eq-cell-flex .eq-cell-main {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eq-cell-sub-inline { display: inline; }
.eq-muted { color: var(--text-muted); }
.eq-th-num, .eq-td-num { text-align: right; }
.eq-td-num { white-space: nowrap; }

/* Margin-health cell: dot + tabular pct on inner spans (never the td). */
.eq-margin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.eq-margin__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}
.eq-margin--good .eq-margin__dot { background: var(--margin-good); }
.eq-margin--warn .eq-margin__dot { background: var(--margin-warn); }
.eq-margin--bad  .eq-margin__dot { background: var(--margin-bad); }
.eq-margin--good .ds-num { color: var(--margin-good-ink); }
.eq-margin--warn .ds-num { color: var(--margin-warn-ink); }
.eq-margin--bad  .ds-num { color: var(--margin-bad-ink); }

/* Skeleton rows swapped in during chip-filter navigation (eq-cockpit.js);
   bars reuse .ds-skel__line — static under prefers-reduced-motion for free. */
.eq-skel-row td {
  padding: 0 16px;
  height: var(--density-row-height);
  border-bottom: 1px solid var(--border-secondary);
}
.eq-skel-row .ds-skel__line { margin: 0; }

/* Empty states inside the grid shell. */
.eq-empty-host { padding: 0 !important; height: auto !important; }
.eq-empty-filtered {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* kbd hint as the card's footer line. */
.eq-kbd-hint--card {
  margin-top: 0;
  padding: 9px 22px 11px;
  border-top: 1px solid var(--border-secondary);
}

/* Create-quote drawer form. */
.eq-create-form .eq-field { margin-bottom: 12px; }
.eq-create-form .eq-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.eq-create-form label {
  display: block;
  font-size: 11px;
  font-weight: var(--font-weight-600);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.eq-create-form input,
.eq-create-form select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface-primary);
  color: var(--text-primary);
}
.eq-create-form input:focus-visible,
.eq-create-form select:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  box-shadow: var(--ring-focus-visible);
}
.eq-create-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

/* Saved-views rail (Aurora 1.2). Collapse = display:none on the whole rail —
   removes tab order + AT exposure + layout in one move; the toggle lives in
   the page head OUTSIDE the collapsing region. */
.eq-body {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.eq-quotes-page[data-rail-collapsed="true"] .eq-body { grid-template-columns: minmax(0, 1fr); }
.eq-quotes-page[data-rail-collapsed="true"] .eq-rail { display: none; }
/* Pure-CSS narrow fallback so the 240px rail never crushes the grid before
   (or without) the matchMedia collapse runs — the grid stacks to one column and
   the rail flows full-width above it. The JS matchMedia sets data-rail-collapsed
   to hide it by default on mobile; the "Views" toggle then still works (removing
   the attribute reveals the stacked rail). Do NOT force display:none here — that
   made the toggle a no-op on mobile (Copilot). */
@media (max-width: 1023px) {
  .eq-body { grid-template-columns: minmax(0, 1fr); }
}

.eq-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  background: var(--surface-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
}
.eq-rail__h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.eq-rail__label {
  font-size: 10.5px;
  font-weight: var(--font-weight-600);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.eq-rail__edit {
  background: none;
  border: 0;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: var(--font-weight-600);
  color: var(--color-accent);
  cursor: pointer;
}
.eq-rail__view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-decoration: none;
}
.eq-rail__view:hover { background: var(--surface-tertiary); }
.eq-rail__view[aria-current="true"] {
  background: var(--color-accent-soft);
  color: var(--ink-on-accent-tint);
  font-weight: var(--font-weight-600);
}
.eq-rail__view[aria-current="true"] .eq-rail__count { color: inherit; }
.eq-rail__view:focus-visible,
.eq-rail__edit:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  box-shadow: var(--ring-focus-visible);
}
.eq-rail__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eq-rail__count { color: var(--text-muted); flex: none; }
.eq-rail__badge {
  font-size: 9px;
  font-weight: var(--font-weight-600);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-left: 5px;
}
.eq-rail__empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 9px;
}
.eq-rail__add { margin-top: 6px; align-self: flex-start; }

/* Edit mode: [data-rail-editing] swaps each editable row's anchor for its
   always-visible inline forms (no hover-only kebabs, everything tabbable). */
.eq-rail__manage { display: none; }
/* Hide the anchor ONLY on rows that have a replacement form (:has editable).
   A regular user's non-editable shared views have no .eq-rail__manage, so they
   must stay visible in edit mode, not vanish. */
[data-rail-editing] .eq-rail__row:has(.eq-rail__manage) .eq-rail__view { display: none; }
[data-rail-editing] .eq-rail__manage {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid var(--border-secondary);
  border-radius: 7px;
  margin-bottom: 4px;
}
.eq-rail__rename {
  display: flex;
  gap: 5px;
}
.eq-rail__rename input {
  flex: 1;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  font-size: 12px;
  background: var(--surface-primary);
  color: var(--text-primary);
}
.eq-rail__rename input:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  box-shadow: var(--ring-focus-visible);
}
.eq-rail__manage-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.eq-view-dismiss {
  font-size: 11.5px;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 2px;
  display: inline-block;
}
.eq-view-dismiss:hover { color: var(--text-primary); }
.eq-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
}

/* Cross-document crossfade on same-origin navigations — app-wide (this sheet
   loads on every page; declared adoption). Progressive Chromium-only; gated
   here because the UA does NOT auto-disable view transitions for
   reduced-motion users. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

