/* RPMS UX viewer (from afomi/qart-ux): one accent colour,
   mono labels, no shadows. The diagram canvas stays light in both themes
   so BPMN notation keeps its contrast. */
:root {
  --surface: #ffffff;
  --raised: #f7f7f7;
  --text: #000000;
  --muted: #777777;
  --border: #e0e0e0;
  --brand: #1f5f8b;
  --shot: #16a34a;
  --gap: #d97706;
  --missing: #dc2626;
  --surface-mark: #737373;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0a0a0a;
    --raised: #171717;
    --text: #fafafa;
    --muted: #a3a3a3;
    --border: #262626;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.label {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

h1 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 600;
}

.heading {
  flex: 1;
}

.drawer-toggle {
  font-size: 16px;
  line-height: 1;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.drawer-toggle[aria-expanded="true"] {
  border-color: var(--brand);
  color: var(--brand);
}

.toggles {
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12px;
}

.toggles input {
  accent-color: var(--brand);
}

.summary,
.notice {
  margin: 0;
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.notice {
  color: var(--gap);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  min-height: 0;
}

.drawer-closed .layout {
  grid-template-columns: 1fr 340px;
}

.drawer-closed .drawer {
  display: none;
}

@media (max-width: 800px) {
  .layout,
  .drawer-closed .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .drawer {
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

/* The drawer: journeys grouped by RPMS package or workflow. */
.drawer {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  background: var(--raised);
}

.drawer-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
}

.drawer-filter .label {
  width: 100%;
}

.drawer-filter input {
  accent-color: var(--brand);
}

.drawer-filter + .drawer-filter {
  padding-top: 12px;
}

.drawer nav {
  display: flex;
  flex-direction: column;
  padding-top: 8px;
}

.drawer nav button {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: 13px;
  padding: 4px 12px 4px 24px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.drawer nav > button {
  padding-left: 12px;
  font-weight: 600;
}

.drawer nav button:hover {
  background: var(--border);
}

.drawer nav button[aria-current="true"] {
  border-left-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

.drawer summary {
  padding: 8px 12px 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.drawer summary .count {
  color: var(--muted);
  font-weight: 400;
}

/* A journey's scope in the phase shown (SCOPE.md "Scope by workflow"). */
.drawer .scope {
  margin-left: 6px;
  padding: 0 4px;
  border: 1px solid var(--muted);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
}

.drawer .scope-in {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.drawer .scope-implied {
  border-color: var(--brand);
  color: var(--brand);
}

.drawer .scope-undecided {
  border-style: dashed;
}

.canvas {
  background: #ffffff;
  min-height: 320px;
}

.detail {
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  background: var(--raised);
}

.detail h2 {
  margin: 4px 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.detail dl {
  margin: 0;
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 4px 8px;
  font-size: 12px;
}

.detail dt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  padding-top: 2px;
}

.detail dd {
  margin: 0;
  font-family: var(--mono);
  word-break: break-all;
}

.detail img {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.detail .suspect {
  margin: 12px 0 0;
  padding-left: 8px;
  border-left: 2px solid var(--missing);
  font-size: 12px;
  color: var(--missing);
}

.detail a {
  color: var(--brand);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 2px solid;
  border-radius: 2px;
  margin-right: -8px;
}

.swatch.shot { border-color: var(--shot); }
.swatch.suspect { border-color: var(--missing); }
.swatch.gap { border-color: var(--gap); border-style: dashed; }
.swatch.surface { border-color: var(--surface-mark); border-style: dotted; }
.swatch.missing { border-color: var(--missing); border-style: dashed; }

/* Coverage markers on BPMN tasks. */
.djs-element.ux-shot .djs-visual > rect { stroke: var(--shot) !important; stroke-width: 3px !important; }
.djs-element.ux-suspect .djs-visual > rect { stroke: var(--missing) !important; stroke-width: 3px !important; }
.djs-element.ux-gap .djs-visual > rect { stroke: var(--gap) !important; stroke-width: 3px !important; stroke-dasharray: 8 5; }
.djs-element.ux-surface .djs-visual > rect { stroke: var(--surface-mark) !important; stroke-dasharray: 2 4; }
.djs-element.ux-missing .djs-visual > rect { stroke: var(--missing) !important; stroke-width: 3px !important; stroke-dasharray: 8 5; }
.djs-element.ux-selected .djs-visual > rect { fill: #fff1ea !important; }

/* Overlays: the page an action lands on, and its screenshot. */
.ux-page {
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  color: #333;
  background: rgba(255, 255, 255, 0.9);
  padding: 0 3px;
}

.ux-thumb {
  display: block;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 2px;
  background: #fff;
  cursor: zoom-in;
}

.ux-thumb img {
  display: block;
  width: 120px;
  height: 72px;
  object-fit: cover;
  object-position: top;
}

.label.spaced {
  margin-top: 16px;
}

.elsewhere {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  font-size: 12px;
}

.elsewhere li {
  padding: 2px 0;
}

.elsewhere button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

/* Hand-off from one journey's end to the next journey. */
.ux-continues {
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  padding: 1px 5px;
  border: 1px dashed var(--brand);
  border-radius: 2px;
  background: #fff;
  color: var(--brand);
  cursor: pointer;
}
