/* Scoped interactive & streamlined UX components for SMT Showroom Construction.
   Inherits tokens, typography (Geist), and spacing rhythm from ledger/design.css & workspace-spacing.css. */

.con-section-gap { margin-top: 28px; }
.tablewrap { overflow-x: auto; }

.con-warn {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 6px;
  display: inline-block;
}

/* Inline controls kept non-flex block-flow where selects appear so Chromium never wraps native carets */
.con-inline-form {
  display: inline-block;
  white-space: nowrap;
}
.con-inline-form > * {
  vertical-align: middle;
  margin-right: 6px;
}
.con-inline-form > *:last-child { margin-right: 0; }
.con-inline-form input[type="text"],
.con-inline-form input[type="number"],
.con-inline-form select {
  width: auto;
  min-width: 128px;
  max-width: 190px;
  height: 38px;
  padding: 6px 10px;
}

/* ── Progress Bars ─────────────────────────────────────────────────────────── */
.con-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line, #e2e8f0);
  overflow: hidden;
  margin-top: 8px;
}
.con-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  transition: width .25s ease;
}
.con-progress-fill.done { background: #16a34a; }
.con-progress-fill.warn { background: #d97706; }

/* ── 8-Stage Interactive Stepper Grid (Overview & Stage Hub) ───────────────── */
.con-stage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.con-stage-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--line, #dce3ec);
  background: var(--surface, #fff);
  color: inherit;
  text-decoration: none;
  min-height: 128px;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.con-stage-card:hover {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
  text-decoration: none;
  transform: translateY(-1px);
}
.con-stage-card.is-active {
  border-color: var(--accent, #2563eb);
  box-shadow: inset 0 0 0 1px var(--accent, #2563eb);
  background: linear-gradient(180deg, rgba(37, 99, 235, .04), var(--surface, #fff) 55%);
}
.con-stage-card.is-completed {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, rgba(22, 163, 74, .03), var(--surface, #fff) 55%);
}
.con-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.con-stage-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted, #64748b);
  font-variant-numeric: tabular-nums;
}
.con-stage-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #0f172a);
  line-height: 1.35;
}
.con-stage-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--muted, #64748b);
  font-variant-numeric: tabular-nums;
}
.con-stage-meta strong {
  color: var(--ink, #0f172a);
  font-weight: 600;
}

/* Compact horizontal 01-08 switcher pill rail inside Stage Detail */
.con-stage-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dce3ec);
  border-radius: 10px;
  margin-bottom: 24px;
}
.con-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink, #1e293b);
  background: var(--surface-soft, #f8fafc);
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.con-stage-pill:hover {
  border-color: var(--line, #cbd5e1);
  background: #fff;
  text-decoration: none;
}
.con-stage-pill.active {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: var(--accent, #2563eb);
}
.con-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.con-dot.active { background: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.con-dot.completed { background: #16a34a; }
.con-stage-pill.active .con-dot { background: #fff; box-shadow: none; }

/* ── Quick Action Bar ──────────────────────────────────────────────────────── */
.con-quickbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dce3ec);
  border-radius: 10px;
  margin-bottom: 24px;
}
.con-quickbar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  margin-right: 4px;
}

/* ── Segmented Sub-Tabs ────────────────────────────────────────────────────── */
.con-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft, #eef2f6);
  border: 1px solid var(--line, #dce3ec);
  border-radius: 10px;
  margin-bottom: 20px;
}
.con-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #475569);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}
.con-tab:hover { color: var(--ink, #0f172a); }
.con-tab.is-active {
  background: var(--surface, #fff);
  color: var(--ink, #0f172a);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.con-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(15, 23, 42, .07);
  color: inherit;
  font-variant-numeric: tabular-nums;
}
.con-tab.is-active .con-count {
  background: rgba(37, 99, 235, .12);
  color: var(--accent, #2563eb);
}
.con-tabpanel[hidden] { display: none !important; }

/* ── Live Search & Filter Chips Toolbar ────────────────────────────────────── */
.con-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.con-search-wrap {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
}
.design-preview .con-search-wrap input[type="search"] {
  width: 100%;
  height: 38px;
  padding: 6px 12px 6px 38px !important;
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 8px;
  background: var(--surface, #fff);
  font-size: 13.5px;
}
.con-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted, #64748b);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  pointer-events: none;
}
.con-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.con-chip {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #fff);
  color: var(--muted, #475569);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.con-chip:hover {
  border-color: var(--accent, #2563eb);
  color: var(--ink, #0f172a);
}
.con-chip.is-active {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}
.con-match-count {
  font-size: 12px;
  color: var(--muted, #64748b);
  font-variant-numeric: tabular-nums;
}

/* ── Slide-Over Quick-Entry Drawers ────────────────────────────────────────── */
.con-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.con-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.con-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(580px, 100vw);
  background: var(--surface, #fff);
  box-shadow: -12px 0 36px rgba(15, 23, 42, .16);
  z-index: 130;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1);
  visibility: hidden;
}
.con-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}
.con-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--surface, #fff);
}
.con-drawer-head h2 {
  margin: 0;
  font-size: 18px;
}
.con-drawer-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted, #64748b);
}
.con-drawer-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface, #fff);
  color: var(--ink, #1e293b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
}
.con-drawer-close:hover { background: var(--surface-soft, #f1f5f9); }
.con-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px;
}
.con-drawer-body .formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.con-drawer-body .field {
  display: block;
  min-width: 0;
}
.con-drawer-body .field.is-wide { grid-column: 1 / -1; }
.con-drawer-body .field.is-hidden { display: none; }
.con-drawer-body .field:has(> input[type="checkbox"]) {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  align-self: end;
  padding: 10px 0;
}
.con-drawer-body .field:has(> input[type="checkbox"]) label { margin: 0; }
.con-drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line, #e2e8f0);
  background: var(--surface-soft, #f8fafc);
}

/* ── Live Calculator & Helper Strip inside Drawers ─────────────────────────── */
.con-calc-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--surface-soft, #f8fafc);
  border: 1px solid var(--line, #dce3ec);
  margin-bottom: 16px;
}
.con-calc-bar span {
  display: block;
  font-size: 11px;
  color: var(--muted, #64748b);
}
.con-calc-bar strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.con-helper-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(37, 99, 235, .08);
  color: var(--accent, #2563eb);
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 14px;
}
.con-helper-pill button {
  border: 1px solid var(--accent, #2563eb);
  background: #fff;
  color: var(--accent, #2563eb);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Helpful Empty States ──────────────────────────────────────────────────── */
.con-empty-cell {
  text-align: center;
  padding: 32px 16px !important;
  color: var(--muted, #64748b);
}
.con-empty-cell p { margin: 0 0 12px; }

/* ── Two-Column Overview Layout ────────────────────────────────────────────── */
.con-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

/* ── Responsive Breakpoints ────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .con-stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .con-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body.design-preview .shell.design-shell { max-width: 100vw; overflow-x: clip; }
  body.design-preview .heading { flex-direction: column; align-items: stretch; gap: 14px; }
  body.design-preview .heading > div { min-width: 0; max-width: 100%; }
  body.design-preview .heading .eyebrow,
  body.design-preview .heading h1,
  body.design-preview .heading p { overflow-wrap: break-word; word-break: break-word; }
  body.design-preview .heading .actions { display: flex; flex-wrap: wrap !important; gap: 8px; width: 100%; max-width: 100%; }
  body.design-preview .heading .actions > * { white-space: normal; text-align: center; }
  .con-quickbar { padding: 12px; gap: 8px; max-width: 100%; }
  .con-quickbar .button { font-size: 13px; padding: 7px 11px; }
  .con-stage-grid { grid-template-columns: 1fr; }
  .con-drawer-body .formgrid { grid-template-columns: 1fr; }
  .con-calc-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .con-tabs { width: 100%; }
  .con-tab { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .con-drawer, .con-drawer-backdrop, .con-stage-card, .con-progress-fill { transition: none; }
}
