/* workflow.css — V3.64 styles for the workflow chooser + workflow-aware
 * top-nav strip. Loaded on rm/index.html and globally by every RM page
 * (since nav.js renders the strip in place of the six-group nav whenever
 * a workflow is active in sessionStorage). */

/* ── Workflow chooser (rm/index.html) ── */
.wf-page .page-header { align-items: center; }
.wf-section { margin-bottom: 28px; }
.wf-section-title {
  font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text, #111827);
  margin: 0 0 6px 0;
}
.wf-section-sub {
  font-size: 13px; color: var(--text-muted, #6b7280);
  line-height: 1.55; margin: 0 0 14px 0; max-width: 720px;
}
.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.wf-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  text-decoration: none; color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .08s;
  cursor: pointer;
}
.wf-card:hover {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 2px 14px rgba(37,99,235,.10);
  transform: translateY(-1px);
}
.wf-card-head { display: flex; align-items: center; gap: 12px; }
.wf-icon {
  font-size: 26px; line-height: 1; flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg, #f8fafc); border-radius: 10px;
}
.wf-titlebox { flex: 1; min-width: 0; }
.wf-label { font-size: 15px; font-weight: 600; color: var(--text, #111827); }
.wf-pagecount {
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted, #6b7280); margin-top: 2px;
}
.wf-desc {
  font-size: 13px; line-height: 1.5; color: var(--text-muted, #4b5563);
}
.wf-pages { display: flex; flex-wrap: wrap; gap: 4px; }
.wf-chip {
  display: inline-block; padding: 2px 8px;
  font-size: 11px; line-height: 1.4;
  background: var(--bg, #f3f4f6); color: var(--text, #374151);
  border: 1px solid var(--border, #e5e7eb); border-radius: 999px;
}
.wf-chip-more {
  background: transparent; color: var(--text-muted, #6b7280);
}
.wf-card-actions {
  display: flex; gap: 4px; align-items: flex-start;
  flex-shrink: 0;
}
.wf-card-actions .btn-sm {
  font-size: 11px; padding: 3px 8px;
}
.wf-custom-card {
  border-left: 3px solid var(--primary, #2563eb);
}
.wf-new-card {
  border-style: dashed; cursor: pointer;
  background: var(--bg, #f8fafc);
}
.wf-new-card:hover {
  background: var(--surface, #fff);
  border-style: solid;
}
.wf-new-card .wf-icon {
  background: var(--primary, #2563eb); color: #fff;
}

/* ── Workflow strip (replaces top-nav while a workflow is active) ── */
.workflow-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
  color: #fff;
  border-bottom: 1px solid #1e3a8a;
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
}
.workflow-strip .ws-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; color: #fff; text-decoration: none;
  font-size: 14px; padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,.18);
  margin-right: 4px;
}
.workflow-strip .ws-brand:hover { color: #dbeafe; }
.workflow-strip .ws-icon { font-size: 18px; line-height: 1; }
.workflow-strip .ws-pages {
  display: flex; align-items: center; gap: 4px;
  flex-wrap: wrap; flex: 1; min-width: 200px;
}
.workflow-strip .ws-page {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  font-size: 12.5px; color: #dbeafe;
  background: rgba(255,255,255,.08); border-radius: 999px;
  text-decoration: none; transition: background .1s, color .1s;
}
.workflow-strip .ws-page:hover {
  background: rgba(255,255,255,.18); color: #fff;
}
.workflow-strip .ws-page.active {
  background: #fff; color: #1e3a8a; font-weight: 600;
}
/* V3.75 — split-mode pill states. Open pills (= showing in left or
 * right pane) get a colored badge prefix; the active pane's pill gets
 * a red border so the user knows which pane will be replaced when
 * they click a closed pill. */
.workflow-strip .ws-page-open {
  background: rgba(255,255,255,.22);
  color: #fff;
  font-weight: 500;
}
.workflow-strip .ws-page-open::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: #fbbf24;
  margin-right: 6px;
  vertical-align: middle;
}
.workflow-strip .ws-page-open--left::before  { background: #34d399; }   /* green dot */
.workflow-strip .ws-page-open--right::before { background: #60a5fa; }   /* blue dot */
.workflow-strip .ws-page-active-split {
  outline: 2px solid #ef4444;
  outline-offset: 1px;
  box-shadow: 0 0 0 2px rgba(239,68,68,.25);
}

/* V3.66 — drag-to-reorder visual states */
.workflow-strip .ws-page[draggable="true"] { cursor: grab; }
.workflow-strip .ws-page[draggable="true"]:active { cursor: grabbing; }
.workflow-strip .ws-page-dragging { opacity: .4; }
.workflow-strip .ws-page-drop-before {
  box-shadow: -3px 0 0 0 #fbbf24 inset;
}
.workflow-strip .ws-page-drop-after {
  box-shadow: 3px 0 0 0 #fbbf24 inset;
}

/* V3.89 — in-shell brand dropdown (workflow switcher). Hover the
 * brand on the workflow strip to open a list of all workflows; click
 * one to switch in-place (popouts stay mounted). */
.workflow-strip .ws-brand-dropdown {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,.18);
  margin-right: 4px;
  user-select: none;
}
.workflow-strip .ws-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}
.workflow-strip .ws-brand-link:hover { color: #dbeafe; }
.workflow-strip .ws-brand-caret {
  font-size: 10px;
  opacity: .7;
  margin-left: 4px;
}
.workflow-strip .ws-brand-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(15,23,42,.14);
  padding: 6px 0;
  z-index: 60;
  color: var(--text, #111827);
  margin-top: 4px;
  max-height: 70vh;
  overflow-y: auto;
}
.workflow-strip .ws-brand-dropdown.open .ws-brand-menu { display: block; }
.workflow-strip .ws-brand-menu-header {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted, #6b7280);
}
.workflow-strip .ws-brand-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text, #111827);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 400;
}
.workflow-strip .ws-brand-menu-item:hover { background: var(--bg, #f3f4f6); }
.workflow-strip .ws-brand-menu-item--active {
  background: color-mix(in srgb, var(--primary, #2563eb) 8%, white);
  font-weight: 600;
}
.workflow-strip .ws-brand-menu-icon {
  font-size: 16px;
  line-height: 1;
}
.workflow-strip .ws-brand-menu-divider {
  height: 1px;
  background: var(--border, #e5e7eb);
  margin: 4px 8px;
}
.workflow-strip .ws-brand-menu-loading {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  font-style: italic;
}

/* V3.66 — pinned "My Workflows" dropdown in the regular nav */
.nav-dropdown-pinned > .nav-dropdown-trigger {
  font-weight: 500;
}
.nav-dropdown-pinned .dropdown-divider {
  height: 1px;
  background: var(--border, #e5e7eb);
  margin: 4px 8px;
}

/* ── V3.74 — RM home page tab toggle (Workflows | All Pages) ── */
.rm-home-tabs {
  display: inline-flex; gap: 4px;
  background: var(--bg, #f3f4f6);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px; padding: 3px;
}
.rm-home-tab {
  display: inline-block;
  padding: 5px 12px; font-size: 13px; font-weight: 500;
  color: var(--text-muted, #6b7280);
  text-decoration: none;
  border-radius: 6px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.rm-home-tab:hover { color: var(--text, #111827); }
.rm-home-tab.active {
  background: var(--surface, #fff);
  color: var(--text, #111827);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

/* ── V3.74 — All Pages tile grid ── */
.ap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.ap-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  text-decoration: none; color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.ap-card:hover {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 1px 8px rgba(37, 99, 235, .08);
  transform: translateY(-1px);
}
.ap-card-head {
  display: flex; align-items: center; gap: 10px;
}
.ap-card-icon {
  font-size: 20px; line-height: 1; flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg, #f8fafc); border-radius: 8px;
}
.ap-card-titlebox { flex: 1; min-width: 0; }
.ap-card-label {
  font-size: 13.5px; font-weight: 600; color: var(--text, #111827);
  display: flex; align-items: center; gap: 6px;
}
.ap-card-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted, #9ca3af); margin-top: 1px;
}
.ap-card-desc {
  font-size: 12.5px; line-height: 1.45;
  color: var(--text-muted, #4b5563);
}
.ap-gate-badge {
  display: inline-block;
  padding: 1px 6px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
  border-radius: 4px;
}
.ap-gate-admin {
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
}
.workflow-strip .ws-page-remove {
  margin-left: 2px; padding: 0 4px;
  background: none; border: none;
  color: inherit; opacity: .5; cursor: pointer; font-size: 14px;
  line-height: 1; border-radius: 50%;
}
.workflow-strip .ws-page-remove:hover { opacity: 1; }
.workflow-strip .ws-actions {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto; flex-wrap: wrap;
}
.workflow-strip .ws-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; font-size: 12px; font-weight: 500;
  background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.2); border-radius: 6px;
  text-decoration: none; cursor: pointer;
  transition: background .1s, border-color .1s;
}
.workflow-strip .ws-btn:hover {
  background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4);
}
.workflow-strip .ws-btn.ws-btn-primary {
  background: #fbbf24; color: #1e3a8a; border-color: #fbbf24;
}
.workflow-strip .ws-btn.ws-btn-primary:hover {
  background: #f59e0b; border-color: #f59e0b;
}

/* ── Add-page picker modal (workflow strip's "+ Add page") ── */
.ws-modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 12px;
  overflow-y: auto;
}
.ws-modal {
  background: #fff; border-radius: 12px;
  max-width: 560px; width: 100%;
  padding: 18px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.ws-modal h3 { margin: 0 0 6px 0; font-size: 16px; }
.ws-modal-sub { font-size: 12.5px; color: var(--text-muted, #6b7280); margin-bottom: 12px; }
.ws-modal-search {
  width: 100%; padding: 8px 10px; font-size: 13px;
  border: 1px solid var(--border, #d1d5db); border-radius: 6px;
  margin-bottom: 10px;
}
.ws-modal-list {
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--border, #e5e7eb); border-radius: 6px;
}
.ws-modal-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px; align-items: center;
  padding: 6px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  background: #fff;
}
.ws-modal-row:hover { background: #eff6ff; }
.ws-modal-row .group {
  font-size: 10px; text-transform: uppercase; letter-spacing: .3px;
  color: var(--text-muted, #6b7280); font-weight: 500;
}
.ws-modal-row .label { color: var(--text, #111827); }
.ws-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border, #e5e7eb);
}
.ws-modal-empty {
  padding: 20px; text-align: center;
  color: var(--text-muted, #6b7280); font-style: italic;
}
