/* =====================================================================
   BatchCanvas — Toolkit, Template Intelligence, Command Palette
   ---------------------------------------------------------------------
   The new surfaces are deliberately quiet: a dark editorial panel with one
   accent, no gradients, no glass. Motion is short (120-220 ms) and always
   respects prefers-reduced-motion.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Data Toolkit bar
   --------------------------------------------------------------------- */
.toolkit-bar {
  position: relative;
}

/* A hairline of accent along the top edge marks this as the working
   surface rather than another read-only panel. */
.toolkit-bar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent);
  opacity: .55;
  border-radius: var(--radius) var(--radius) 0 0;
}

.toolkit-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
}

.toolkit-button {
  display: grid;
  grid-template-columns: 20px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  row-gap: 2px;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}

.toolkit-button svg {
  grid-row: 1 / 3;
  width: 18px;
  height: 18px;
  color: var(--accent);
  transition: transform .18s cubic-bezier(.16, 1, .3, 1);
}

.toolkit-button span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.toolkit-button em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.35;
}

.toolkit-button:hover {
  background: var(--panel-3);
  border-color: var(--line-strong);
}

.toolkit-button:hover svg {
  transform: translateX(2px);
}

.toolkit-button:active {
  transform: translateY(1px);
}

.toolkit-button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Review strip — the sign-off workflow
   --------------------------------------------------------------------- */
.review-strip {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 6px;
  background: var(--panel-2);
}

.review-strip-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.review-strip-head .muted {
  font-size: 11px;
}

.review-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  min-height: 28px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--muted);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.review-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.review-chip.is-active {
  color: var(--text);
  border-color: var(--accent);
  background: #2a2323;
}

.review-chip-count {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .35);
}

.review-strip-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.review-strip-actions .muted {
  font-size: 11px;
}

/* ---------------------------------------------------------------------
   Toolkit modal
   --------------------------------------------------------------------- */
.toolkit-overlay {
  background: rgba(0, 0, 0, .58);
}

.toolkit-modal {
  width: min(760px, 94vw);
  max-width: 760px;
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  text-align: left;
  animation: toolkit-in .2s cubic-bezier(.16, 1, .3, 1);
}

@keyframes toolkit-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.toolkit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolkit-title {
  font-size: 18px;
  margin: 6px 0 0;
  color: var(--text);
}

.toolkit-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.toolkit-tabs::-webkit-scrollbar {
  display: none;
}

.toolkit-tab {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease, background-color .15s ease;
}

.toolkit-tab:hover {
  color: var(--text);
}

.toolkit-tab.is-active {
  color: var(--text);
  background: var(--panel-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.toolkit-panels {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.toolkit-panel[hidden] {
  display: none !important;
}

.toolkit-lead {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 14px;
}

.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.toolkit-options {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolkit-count {
  font-size: 11px;
  min-height: 16px;
  margin: 0 0 10px;
}

.toolkit-actions {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toolkit-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.toolkit-split-col {
  display: grid;
  gap: 9px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.toolkit-split-col h4 {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.toolkit-split-col .muted {
  font-size: 11px;
  margin: -4px 0 4px;
}

.toolkit-split-col select[multiple] {
  min-height: 92px;
}

.toolkit-rule-list,
.style-painter-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
}

.toolkit-rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  font-size: 11.5px;
}

.toolkit-rule-main em {
  font-style: normal;
  color: var(--accent);
  font-weight: 700;
  margin-right: 4px;
}

/* Column hygiene: the two chores that turn a messy roster into a printable
   one. Deliberately quieter than the merge/split cards above it — they are
   maintenance, not composition. */
.toolkit-hygiene {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.toolkit-hygiene-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.toolkit-hygiene-item h4 {
  margin: 0 0 3px;
  font-size: 12.5px;
  color: var(--text);
}

.toolkit-hygiene-item .muted {
  font-size: 11px;
  margin: 0;
}

.toolkit-hygiene-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toolkit-hygiene-controls .form-field {
  min-width: 96px;
}

.toolkit-hygiene-item .toolkit-rule-list {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  max-height: 130px;
}

.toolkit-empty {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  text-align: center;
}

.style-painter-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
  font-size: 12px;
  transition: border-color .15s ease, background-color .15s ease;
}

.style-painter-row:hover {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.style-painter-row span {
  flex: 1;
  min-width: 0;
}

.style-painter-row em {
  font-size: 10px;
}

/* ---------------------------------------------------------------------
   Template Intelligence (inspector)
   --------------------------------------------------------------------- */
.intelligence-block {
  margin-bottom: 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--panel-2);
}

.intelligence-block .eyebrow {
  margin-bottom: 8px;
}

.intelligence-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.intelligence-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

/* ---------------------------------------------------------------------
   Batch Health (preflight)
   --------------------------------------------------------------------- */
.batch-health-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.batch-health-list {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  max-height: 260px;
  overflow-y: auto;
}

.batch-health-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 11.5px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}

.batch-health-item:hover {
  background: var(--panel-3);
  transform: translateX(2px);
}

.batch-health-item.is-overflow {
  border-left-color: var(--danger);
}

.batch-health-item.is-rule {
  border-left-color: var(--warning);
}

.batch-health-item.is-collision {
  border-left-color: #a78bfa;
}

/* ---------------------------------------------------------------------
   Command Palette
   --------------------------------------------------------------------- */
.palette-overlay {
  align-items: flex-start !important;
  padding-top: 12vh !important;
  background: rgba(0, 0, 0, .55);
}

.palette-modal {
  width: min(620px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: palette-in .16s cubic-bezier(.16, 1, .3, 1);
}

@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(.99);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.palette-search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
}

.palette-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.palette-search input::placeholder {
  color: var(--muted);
}

.palette-results {
  max-height: 46vh;
  overflow-y: auto;
  padding: 6px;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color .12s ease;
}

.palette-item em {
  font-style: normal;
  font-size: 10.5px;
  flex-shrink: 0;
}

.palette-item.is-active,
.palette-item:hover {
  background: var(--panel-3);
}

.palette-footer {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted);
}

.kbd-hint {
  display: inline-block;
  padding: 1px 5px;
  margin-right: 3px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
   Micro-interactions
   ---------------------------------------------------------------------
   Small, deliberate motion on the surfaces people touch most. Every rule
   is scoped so it cannot leak into the canvas or the print preview.
   --------------------------------------------------------------------- */

/* The field layer list: the row lifts a hair and its colour dot pulses
   when it is the active layer. */
.field-item {
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease;
}

.field-item:hover {
  transform: translateX(2px);
}

.field-item.is-active {
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}

/* Buttons: a soft press with a hair of movement downward, and the accent
   colour blooms on the border rather than the fill. */
.button,
.icon-button,
.preset,
.review-chip,
.toolkit-button,
.batch-health-item {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .12s ease, box-shadow .15s ease;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  box-shadow: 0 0 0 1px var(--line-strong);
}

/* The primary export button gets a hair of lift on hover. Deliberately not
   an infinite pulse — the export panel already has a progress dock, and a
   permanently breathing button reads as an alarm rather than an affordance. */
.button.primary.large {
  transition: background-color .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}

.button.primary.large:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .32);
}

/* Toasts slide in from the edge they belong to. */
.toast {
  animation: toast-in .22s cubic-bezier(.16, 1, .3, 1);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* The linter badges fade rather than snap when their state changes. */
.linter-stat-badge {
  transition: opacity .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* The processing dock reports progress; the bar eases so the eye can
   follow it instead of chasing a jumpy number. */
#hudProgressBar {
  transition: width .22s cubic-bezier(.4, 0, .2, 1);
}

/* The privacy tray and the shared dock share the same z-index, so the tray
   is suppressed rather than stacked. Its own slide-in animation lives in
   styles.css and is left alone here — the tray is centred with a
   translateX(-50%), so no transform may be applied from this file. */

/* Focus rings for the new controls, matching the app's existing focus
   colour so keyboard users see one consistent affordance. */
.toolkit-button:focus-visible,
.toolkit-tab:focus-visible,
.review-chip:focus-visible,
.palette-item:focus-visible,
.batch-health-item:focus-visible,
.style-painter-row:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 760px) {
  .toolkit-split {
    grid-template-columns: 1fr;
  }

  .toolkit-button-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

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

  .palette-overlay {
    padding-top: 6vh !important;
  }
}

/* ---------------------------------------------------------------------
   Reusable design templates
   --------------------------------------------------------------------- */
.design-template-block {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--panel-2);
}

.design-template-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  transition: border-color .15s ease, background-color .15s ease;
}

.design-template-row:hover {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.design-template-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Export profiles and the proof-copy redaction
   --------------------------------------------------------------------- */
.export-profile-strip {
  margin-top: 16px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--panel-2);
}

.export-profile-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
   Reduced motion
   ---------------------------------------------------------------------
   The app has a lot of motion now. Respect the OS setting completely:
   nothing decorative should move for someone who asked it not to.
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  .button.primary.large {
    animation: none;
    transform: none;
  }
}
