/* Process workspace. All rules are isolated from the other AdminDesk drawers. */
#processDrawer {
  --pd-bg: var(--atlas-surface, #f6f6f8);
  --pd-panel: var(--atlas-page-bg, #fff);
  --pd-control: var(--atlas-input-bg, #fff);
  --pd-ink: var(--atlas-ink, #111216);
  --pd-muted: var(--atlas-muted, #707078);
  --pd-line: var(--atlas-line, #e3e3e8);
  --pd-accent: var(--atlas-accent, #6550a1);
  --pd-accent-soft: color-mix(in srgb, var(--pd-accent) 9%, var(--pd-panel));
  --pd-accent-ink: #fff;
  --pd-success: #267647;
  --pd-success-soft: #eef7f1;
  --pd-warning: #906114;
  --pd-warning-soft: #fbf4e6;
  --pd-info: #3a69a6;
  --pd-info-soft: #edf3fb;
  --pd-danger: #b42318;
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 13, 18, .3);
  backdrop-filter: blur(4px);
}

html[data-theme="dark"] #processDrawer {
  --pd-accent-ink: #191321;
  --pd-success: #85b99a;
  --pd-success-soft: #203129;
  --pd-warning: #d5b978;
  --pd-warning-soft: #332e22;
  --pd-info: #9bb8e7;
  --pd-info-soft: #242e40;
  --pd-danger: #eeaaa4;
  color-scheme: dark;
  background: rgba(3, 4, 7, .5);
}

#processDrawer .drawer {
  position: relative;
  inset: auto;
  width: min(1120px, calc(100vw - 40px));
  height: calc(100vh - 40px);
  height: calc(100dvh - 40px);
  border: 1px solid var(--pd-line);
  border-radius: 14px;
  background: var(--pd-bg);
  color: var(--pd-ink);
  box-shadow: 0 24px 100px rgba(10, 12, 20, .2);
  transform: translateX(24px);
  transition: transform .25s var(--ease, ease);
}

#processDrawer.open .drawer { transform: none; }
#processDrawer .drawer-head {
  min-height: 116px;
  padding: 23px 25px;
  gap: 24px;
  background: var(--pd-panel);
  border-bottom: 1px solid var(--pd-line);
  backdrop-filter: none;
  align-items: center;
}

#processDrawer .drawer-title { flex: 1; min-width: 0; }
#processDrawer .process-identity { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
#processDrawer .process-identity-icon { display: grid; place-items: center; width: 43px; height: 43px; flex: 0 0 43px; border: 1px solid color-mix(in srgb, var(--pd-accent) 13%, var(--pd-line)); border-radius: 10px; background: var(--pd-accent-soft); color: var(--pd-accent); }
#processDrawer .process-identity-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
#processDrawer .process-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--pd-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.3;
  text-transform: uppercase;
}

#processDrawer .process-kicker > span {
  display: inline;
  margin: 0;
  color: inherit;
  font: inherit;
}

#processDrawer .process-kicker .process-reference {
  padding-left: 10px;
  border-left: 1px solid var(--pd-line);
  font-weight: 500;
  letter-spacing: .025em;
  text-transform: none;
}

#processDrawer .drawer-title h2 {
  margin: 0;
  color: var(--pd-ink);
  font-size: clamp(21px, 2vw, 26px);
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -.035em;
  white-space: normal;
  overflow-wrap: anywhere;
}

#processDrawer .process-vehicle {
  margin: 6px 0 0;
  color: var(--pd-muted);
  font-size: 13px;
  font-weight: 450;
  line-height: 1.4;
}

#processDrawer .process-head-actions {
  display: flex;
  align-items: center;
  gap: 17px;
  flex: 0 0 auto;
}

#processDrawer .drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--pd-line);
  border-radius: 8px;
  background: var(--pd-panel);
  color: var(--pd-muted);
  transition: background .15s, color .15s, transform .15s;
}

#processDrawer .drawer-close:hover { background: var(--pd-bg); color: var(--pd-ink); transform: translateY(-1px); }
#processDrawer .drawer-close svg { width: 16px; height: 16px; stroke: currentColor; }
#processDrawer .drawer-body {
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--pd-muted) 40%, transparent) transparent;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

#processDrawer .detail-panel {
  border: 1px solid var(--pd-line);
  border-radius: 10px;
  background: var(--pd-panel);
  box-shadow: 0 1px 2px rgba(12, 13, 18, .015);
}

#processDrawer .detail-panel-head {
  min-height: 67px;
  padding: 16px 19px;
  border-bottom: 1px solid var(--pd-line);
  align-items: center;
  gap: 12px;
}

#processDrawer .detail-panel-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--pd-ink);
  font-size: 13px;
  font-weight: 670;
  line-height: 1.4;
  letter-spacing: -.015em;
}

#processDrawer .process-section-icon { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--pd-accent); }

#processDrawer .detail-panel-head p {
  margin: 3px 0 0;
  color: var(--pd-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
}

#processDrawer .detail-content { padding: 19px; }
#processDrawer .process-overview { margin-bottom: 16px; }
#processDrawer .process-overview .detail-panel-head {
  min-height: 48px;
  padding: 14px 19px 0;
  border-bottom: 0;
}

#processDrawer .process-count {
  color: var(--pd-muted);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

#processDrawer .process-overview .detail-content { padding: 16px 16px 11px; }
#processDrawer .pipeline {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0;
  width: 100%;
}

#processDrawer .stage {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 64px;
  padding: 0 3px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--pd-muted);
  transition: color .15s;
}

#processDrawer .stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 14px;
  left: calc(-50% + 17px);
  width: calc(100% - 34px);
  height: 1px;
  background: var(--pd-line);
}

#processDrawer .stage:first-child::before { display: none; }
#processDrawer .stage .stage-marker {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  margin: 0;
  border: 1px solid var(--pd-line);
  border-radius: 50%;
  background: var(--pd-panel);
  color: var(--pd-muted);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, background .15s, transform .18s;
}

#processDrawer .stage .stage-marker svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#processDrawer .stage strong { font-size: 10px; font-weight: 500; line-height: 1.4; }
#processDrawer .stage.done { color: var(--pd-ink); }
#processDrawer .stage.done::before,
#processDrawer .stage.current::before { background: color-mix(in srgb, var(--pd-success) 35%, var(--pd-line)); }
#processDrawer .stage.done .stage-marker {
  border-color: color-mix(in srgb, var(--pd-success) 20%, var(--pd-line));
  background: var(--pd-success-soft);
  color: var(--pd-success);
}

#processDrawer .stage.current { color: var(--pd-accent); }
#processDrawer .stage.current .stage-marker {
  border-color: var(--pd-accent);
  background: var(--pd-accent);
  color: var(--pd-accent-ink);
  box-shadow: 0 0 0 4px var(--pd-accent-soft);
}

#processDrawer .stage.current strong { font-weight: 700; }
#processDrawer .stage:hover { color: var(--pd-accent); }
#processDrawer .stage:hover .stage-marker { border-color: var(--pd-accent); transform: translateY(-1px) scale(1.04); }
#processDrawer .detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, .94fr);
  align-items: start;
  gap: 16px;
}

#processDrawer .process-main,
#processDrawer .process-aside { min-width: 0; }
#processDrawer .process-data-panel .detail-content { padding: 0 19px; }
#processDrawer .process-field-group { padding: 20px 0; }
#processDrawer .process-field-group + .process-field-group { border-top: 1px solid var(--pd-line); }
#processDrawer .process-field-group h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 13px;
  color: var(--pd-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .065em;
  line-height: 1.4;
  text-transform: uppercase;
}

#processDrawer .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 12px; }
#processDrawer .field { gap: 6px; min-width: 0; }
#processDrawer .field label { color: var(--pd-muted); font-size: 11px; font-weight: 500; line-height: 1.35; }
#processDrawer .field input,
#processDrawer .field select,
#processDrawer .field textarea {
  width: 100%;
  border: 1px solid var(--pd-line);
  border-radius: 7px;
  background: var(--pd-control);
  color: var(--pd-ink);
  font-size: 13px;
  font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}

#processDrawer .field input,
#processDrawer .field select { height: 40px; padding: 0 11px; }
#processDrawer .field textarea { min-height: 88px; padding: 11px; }
#processDrawer .field input:focus,
#processDrawer .field select:focus,
#processDrawer .field textarea:focus {
  border-color: var(--pd-accent);
  background: var(--pd-control);
  box-shadow: 0 0 0 3px var(--atlas-focus, rgba(101, 80, 161, .13));
}

#processDrawer .process-documents .detail-panel-head { align-items: flex-start; }
#processDrawer .process-doc-heading { min-width: 0; }
#processDrawer .process-doc-count { flex-shrink: 0; text-align: right; }
#processDrawer .process-doc-count strong { display: block; color: var(--pd-ink); font-size: 20px; font-weight: 620; letter-spacing: -.03em; line-height: 1.2; }
#processDrawer .process-doc-count > span { display: block; margin-top: 3px; color: var(--pd-muted); font-size: 10px; line-height: 1.3; }
#processDrawer .process-doc-count strong > span { display: inline; margin: 0; color: var(--pd-muted); font-size: 13px; font-weight: 450; letter-spacing: 0; }
#processDrawer .process-doc-progress { height: 3px; overflow: hidden; background: var(--pd-bg); }
#processDrawer .process-doc-progress > span { display: block; height: 100%; background: var(--pd-accent); transition: width .4s; }
#processDrawer .process-documents .detail-content { padding: 0 17px; }
#processDrawer .checklist { display: block; }
#processDrawer .check-item.document-check-item {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-height: 63px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--pd-line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  transition: background .16s;
}

#processDrawer .check-item.document-check-item:last-child { border-bottom: 0; }
#processDrawer .check-item.document-check-item:hover { background: color-mix(in srgb, var(--pd-accent) 3%, var(--pd-panel)); }
#processDrawer .check-toggle {
  width: 23px;
  height: 23px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--pd-muted) 30%, var(--pd-line));
  border-radius: 6px;
  background: var(--pd-panel);
  color: var(--pd-accent);
  transition: border-color .15s, background .15s;
}

#processDrawer .check-toggle:hover { border-color: var(--pd-accent); background: var(--pd-accent-soft); }
#processDrawer .check-item.done .check-toggle {
  border-color: color-mix(in srgb, var(--pd-success) 28%, var(--pd-line));
  background: var(--pd-success-soft);
  color: var(--pd-success);
}

#processDrawer .check-item.done .check-toggle::after { border-color: var(--pd-success); }
#processDrawer .document-check-copy { min-width: 0; margin: 0; }
#processDrawer .document-check-copy strong { color: var(--pd-ink); font-size: 12px; font-weight: 550; line-height: 1.4; }
#processDrawer .document-check-copy > span { margin-top: 3px; color: var(--pd-muted); font-size: 10px; line-height: 1.4; }
#processDrawer .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 27px;
  padding: 0 9px;
  border-radius: 5px;
  background: var(--pd-bg);
  color: var(--pd-muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  margin: 0;
  white-space: nowrap;
}

#processDrawer .status::before { width: 5px; height: 5px; background: currentColor; }
#processDrawer .status.purple { background: var(--pd-accent-soft); color: var(--pd-accent); }
#processDrawer .status.green { background: var(--pd-success-soft); color: var(--pd-success); }
#processDrawer .status.amber { background: var(--pd-warning-soft); color: var(--pd-warning); }
#processDrawer .status.blue { background: var(--pd-info-soft); color: var(--pd-info); }
#processDrawer .status.red { background: color-mix(in srgb, var(--pd-danger) 8%, var(--pd-panel)); color: var(--pd-danger); }
#processDrawer .document-check-manage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 29px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--pd-muted);
  font-size: 11px;
  font-weight: 550;
  transition: color .15s, background .15s, transform .15s;
}

#processDrawer .document-check-manage svg { width: 12px; height: 12px; flex: 0 0 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#processDrawer .document-check-manage:hover { border-color: transparent; background: var(--pd-accent-soft); color: var(--pd-accent); transform: translateX(1px); }
#processDrawer .process-bottom-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(360px, .94fr); gap: 16px; margin-top: 16px; align-items: start; }
#processDrawer .process-followup { display: grid; gap: 16px; }
#processDrawer .process-empty { padding: 9px 0; color: var(--pd-muted); font-size: 12px; line-height: 1.5; }
#processDrawer .notes { gap: 12px; }
#processDrawer .note { padding: 13px 14px; border: 1px solid var(--pd-line); border-radius: 7px; background: var(--pd-bg); }
#processDrawer .note-top { gap: 10px; }
#processDrawer .note-top strong { color: var(--pd-ink); font-size: 11px; font-weight: 600; }
#processDrawer .note-top time { color: var(--pd-muted); font-size: 10px; }
#processDrawer .note p { margin: 7px 0 0; color: var(--pd-ink); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
#processDrawer .priority-item { gap: 10px; border-radius: 6px; }
#processDrawer .priority-icon { width: 31px; height: 31px; border-radius: 7px; background: var(--pd-bg); }
#processDrawer .priority-main strong { color: var(--pd-ink); font-size: 12px; font-weight: 550; white-space: normal; line-height: 1.45; }
#processDrawer .priority-main span { color: var(--pd-muted); font-size: 10px; line-height: 1.5; }
#processDrawer .process-delivery-summary strong { display: block; color: var(--pd-ink); font-size: 13px; font-weight: 600; line-height: 1.5; }
#processDrawer .process-delivery-summary span { display: block; margin-top: 4px; color: var(--pd-muted); font-size: 12px; line-height: 1.5; }
#processDrawer .btn { min-height: 35px; padding: 0 12px; border: 1px solid var(--pd-line); border-radius: 7px; background: var(--pd-panel); color: var(--pd-ink); font-size: 11px; font-weight: 600; box-shadow: none; }
#processDrawer .btn:hover { transform: none; border-color: color-mix(in srgb, var(--pd-muted) 40%, var(--pd-line)); background: var(--pd-bg); }
#processDrawer .btn.primary { border-color: var(--pd-accent); background: var(--pd-accent); color: var(--pd-accent-ink); }
#processDrawer .btn.primary:hover { filter: brightness(.95); }
#processDrawer .btn.danger { color: var(--pd-danger); }
#processDrawer .btn.danger:hover { border-color: color-mix(in srgb, var(--pd-danger) 30%, var(--pd-line)); background: color-mix(in srgb, var(--pd-danger) 4%, var(--pd-panel)); }
#processDrawer .drawer-footer {
  min-height: 72px;
  padding: 15px 24px;
  gap: 18px;
  border-top: 1px solid var(--pd-line);
  background: var(--pd-panel);
  backdrop-filter: none;
}

#processDrawer .save-state { display: inline-flex; align-items: center; gap: 7px; color: var(--pd-muted); font-size: 10px; line-height: 1.5; }
#processDrawer .save-state::before { content: ""; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: var(--pd-success); }
#processDrawer .drawer-footer-right { display: flex; gap: 8px; flex-shrink: 0; }
#processDrawer .drawer-footer .btn { min-height: 38px; padding: 0 16px; font-size: 12px; }
#processDrawer :is(button, input, select, textarea):focus-visible { outline: 2px solid var(--pd-accent); outline-offset: 3px; }
#processDrawer :is(input, select, textarea):focus-visible { outline-offset: 1px; }

/* Played by the drawer's opening state, never by an autosave render. */
@keyframes atlasProcessReveal {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes atlasProcessCurrent {
  0% { transform: scale(.88); }
  65% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

#processDrawer.is-entering .drawer-head { animation: atlasProcessReveal .32s ease both; }
#processDrawer.is-entering .process-overview { animation: atlasProcessReveal .38s ease .05s both; }
#processDrawer.is-entering .process-data-panel { animation: atlasProcessReveal .38s ease .09s both; }
#processDrawer.is-entering .process-documents { animation: atlasProcessReveal .38s ease .12s both; }
#processDrawer.is-entering .process-bottom-grid { animation: atlasProcessReveal .38s ease .16s both; }
#processDrawer.is-entering .document-check-item { animation: atlasProcessReveal .26s ease calc(.2s + var(--document-index, 0) * .018s) both; }
#processDrawer.is-entering .stage.current .stage-marker { animation: atlasProcessCurrent .35s ease .16s both; }

@media (max-width: 960px) {
  #processDrawer .detail-grid,
  #processDrawer .process-bottom-grid { grid-template-columns: minmax(0, 1fr); }
  #processDrawer .process-documents .check-item.document-check-item { min-height: 59px; }
  #processDrawer .process-documents .detail-content { padding: 0 19px; }
}

@media (max-width: 760px) {
  #processDrawer .drawer { width: calc(100vw - 24px); height: calc(100vh - 24px); height: calc(100dvh - 24px); }
  #processDrawer .drawer-head { padding: 19px 20px; gap: 16px; }
  #processDrawer .process-head-actions { gap: 10px; }
  #processDrawer .drawer-body { padding: 15px; }
  #processDrawer .process-overview .detail-content { overflow-x: auto; scrollbar-width: thin; padding: 16px 15px 12px; }
  #processDrawer .pipeline { min-width: 760px; }
  #processDrawer .drawer-footer { padding: 14px 20px; }
}

@media (max-width: 600px) {
  #processDrawer .drawer { width: 100%; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  #processDrawer .drawer-head { min-height: 112px; padding: 18px 16px; gap: 10px; align-items: flex-start; }
  #processDrawer .drawer-title h2 { font-size: 21px; }
  #processDrawer .process-identity { gap: 10px; }
  #processDrawer .process-identity-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 8px; align-self: flex-start; margin-top: 3px; }
  #processDrawer .process-identity-icon svg { width: 18px; height: 18px; }
  #processDrawer .process-kicker { flex-wrap: wrap; gap: 6px; font-size: 9px; margin-bottom: 8px; }
  #processDrawer .process-kicker .process-reference { padding-left: 6px; }
  #processDrawer .process-vehicle { font-size: 12px; }
  #processDrawer .process-head-actions { flex-direction: column-reverse; align-items: flex-end; gap: 10px; }
  #processDrawer .process-head-actions > .status { height: 24px; padding: 0 6px; font-size: 9px; }
  #processDrawer .drawer-close { width: 31px; height: 31px; }
  #processDrawer .drawer-body { padding: 12px; scrollbar-gutter: auto; }
  #processDrawer .detail-panel-head { padding: 15px; }
  #processDrawer .detail-content { padding: 15px; }
  #processDrawer .process-data-panel .detail-content { padding: 0 15px; }
  #processDrawer .process-field-group { padding: 18px 0; }
  #processDrawer .fields { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  #processDrawer .field input,
  #processDrawer .field select,
  #processDrawer .field textarea { font-size: 16px; }
  #processDrawer .field input,
  #processDrawer .field select { height: 43px; }
  #processDrawer .process-documents .detail-content { padding: 0 13px; }
  #processDrawer .check-item.document-check-item { grid-template-columns: 23px minmax(0, 1fr) auto; gap: 8px; }
  #processDrawer .document-check-copy strong { font-size: 11px; }
  #processDrawer .document-check-copy > span { font-size: 10px; }
  #processDrawer .document-check-item > .status { display: none; }
  #processDrawer .document-check-manage { font-size: 11px; padding: 0 6px; }
  #processDrawer .drawer-footer { min-height: 76px; padding: 12px 15px; gap: 10px; }
  #processDrawer .drawer-footer-left { flex: 1; min-width: 0; }
  #processDrawer .save-state { font-size: 9px; max-width: 130px; }
  #processDrawer .drawer-footer .btn { min-height: 39px; padding: 0 12px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  #processDrawer,
  #processDrawer * { animation: none !important; transition: none !important; }
}
