/* GCE Workflow AI panel — matches ops mockup (light card, purple accents) */

.gce-ai-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 12050;
  min-width: 88px;
  height: 48px;
  padding: 0 16px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font: 800 12px/1 inherit;
  color: #fff;
  background: #1e3a8a;
  box-shadow: 0 14px 32px rgba(30, 58, 138, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gce-ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(30, 58, 138, 0.45);
}

/* Safety check-in review: sticky Approve bar uses the same corner. */
body:has(.sfty-rv2-sticky) .gce-ai-fab,
body:has(#fin-sal-page-root) .gce-ai-fab {
  bottom: 96px;
}

body.gce-sites-mockup .gce-ai-fab {
  bottom: 16px;
  right: 16px;
}

.gce-ai-fab[hidden] {
  display: none !important;
}

.gce-ai-panel.gce-wf-panel,
.gce-wf-panel {
  position: fixed;
  right: 18px;
  top: 72px;
  bottom: 18px;
  z-index: 12049;
  width: min(420px, calc(100vw - 28px));
  max-height: none;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid #e8ecf3;
  background: #ffffff;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.16),
    0 2px 0 rgba(255, 255, 255, 0.9) inset;
  overflow: hidden;
  color: #0f172a;
}

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

.gce-wf-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.gce-wf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #eef2f7;
  flex-shrink: 0;
}

.gce-wf-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gce-wf-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #1e3a8a;
  flex-shrink: 0;
}

.gce-wf-brand b {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}

.gce-wf-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.gce-wf-online::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.gce-wf-online.is-on {
  color: #166534;
}

.gce-wf-online.is-on::before {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.gce-wf-online.is-off {
  color: #991b1b;
}

.gce-wf-online.is-off::before {
  background: #ef4444;
}

.gce-wf-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.gce-wf-page-pill {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 5px 10px;
}

.gce-wf-icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.gce-wf-icon-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.gce-wf-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gce-wf-scroll--agent {
  padding-bottom: 4px;
}

.gce-wf-agent-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  z-index: 2;
}

.gce-wf-hello--agent {
  margin: 0;
}

.gce-wf-hello--agent h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.gce-wf-hello--agent p {
  margin: 0 !important;
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}

.gce-wf-agent-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: #475569;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #d8e0ea;
}

.gce-wf-agent-stats b {
  color: #0f172a;
  font-weight: 800;
}

.gce-wf-pills--agent {
  margin-bottom: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.gce-wf-chat-log--agent {
  flex: 1 1 0;
  min-height: 0;
  max-height: none !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 16px 14px;
  background: #fafbfc;
  position: relative;
  z-index: 0;
}

.gce-wf-chat-empty {
  margin: auto 0;
  padding: 12px 4px 8px;
}

.gce-wf-chat-empty-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.gce-wf-chat-empty-sub {
  margin: 0 0 12px;
  font-size: 13px;
  color: #475569;
}

.gce-wf-chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gce-wf-suggest {
  text-align: left;
  border: 1px solid #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
  border-radius: 10px;
  padding: 10px 12px;
  font: 650 12.5px/1.35 inherit;
  cursor: pointer;
}

.gce-wf-suggest:hover {
  background: #bfdbfe;
}

.gce-wf-composer .gce-wf-input {
  flex: 1;
}

.gce-wf-send {
  background: #1e3a8a !important;
}

.gce-wf-chat-bubble--user {
  background: #dbeafe !important;
  color: #1e3a8a !important;
}

.gce-wf-chat-bubble--bot {
  background: #fff !important;
  border: 1px solid #d8e0ea;
  color: #0f172a !important;
}

.gce-wf-hello h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.gce-wf-hello p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #64748b;
}

.gce-wf-hello b {
  color: #5b21b6;
  font-weight: 800;
}

.gce-wf-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 55%, #4c1d95 100%);
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 12px 28px rgba(91, 33, 182, 0.28);
}

.gce-wf-summary-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  min-width: 0;
}

.gce-wf-stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.gce-wf-stat svg {
  opacity: 0.9;
  flex-shrink: 0;
}

.gce-wf-stat b {
  font-weight: 800;
  color: #fff;
}

.gce-wf-summary-cta {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font: 800 11px/1 inherit;
  cursor: pointer;
  white-space: nowrap;
}

.gce-wf-summary-cta:hover {
  background: rgba(255, 255, 255, 0.22);
}

.gce-wf-flow,
.gce-wf-recs {
  margin-bottom: 16px;
}

.gce-wf-flow h3,
.gce-wf-recs h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.gce-wf-flow-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.gce-wf-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
}

.gce-wf-step--active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.gce-wf-step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  background: #e2e8f0;
  color: #475569;
  flex-shrink: 0;
}

.gce-wf-step-badge--done {
  background: #16a34a;
  color: #fff;
}

.gce-wf-step--active .gce-wf-step-badge {
  background: #1e3a8a;
  color: #fff;
}

.gce-wf-step-copy {
  min-width: 0;
  flex: 1;
}

.gce-wf-step-copy b {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.gce-wf-step-label {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.gce-wf-step--done .gce-wf-step-label {
  color: #166534;
}

.gce-wf-step--active .gce-wf-step-label {
  color: #1e40af;
}

.gce-wf-step-progress {
  margin-top: 8px;
}

.gce-wf-step-progress > span {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}

.gce-wf-step-bar {
  margin-top: 5px;
  height: 6px;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
}

.gce-wf-step-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1e3a8a, #1e3a8a);
}

.gce-wf-recs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gce-wf-rec {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #fff;
  min-height: 148px;
}

.gce-wf-rec-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.gce-wf-rec--assign .gce-wf-rec-icon {
  background: #dcfce7;
  color: #166534;
}

.gce-wf-rec--warn .gce-wf-rec-icon {
  background: #fef3c7;
  color: #a16207;
}

.gce-wf-rec-copy {
  flex: 1;
}

.gce-wf-rec-copy b {
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  color: #0f172a;
  margin-bottom: 4px;
}

.gce-wf-rec-copy span {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  color: #64748b;
}

.gce-wf-rec-btn {
  align-self: stretch;
  border-radius: 10px;
  padding: 8px 10px;
  font: 800 12px/1 inherit;
  cursor: pointer;
  border: 1px solid transparent;
}

.gce-wf-rec--assign .gce-wf-rec-btn {
  background: #5b21b6;
  color: #fff;
}

.gce-wf-rec--warn .gce-wf-rec-btn {
  background: #fff;
  border-color: #d8e0ea;
  color: #0f172a;
}

.gce-wf-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.gce-wf-pill {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 7px 11px;
  font: 700 11px/1.2 inherit;
  cursor: pointer;
}

.gce-wf-pill:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #5b21b6;
}

.gce-wf-chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  max-height: 160px;
  overflow: auto;
}

.gce-wf-chat-log[hidden] {
  display: none !important;
}

.gce-wf-chat-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.gce-wf-chat-bubble--user {
  align-self: flex-end;
  background: #ede9fe;
  color: #4c1d95;
  border-bottom-right-radius: 4px;
}

.gce-wf-chat-bubble--bot {
  align-self: flex-start;
  background: #f1f5f9;
  color: #334155;
  border-bottom-left-radius: 4px;
}

.gce-wf-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.gce-wf-follow {
  border: 1px solid #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 5px 10px;
  font: 650 11px/1.2 inherit;
  cursor: pointer;
}

.gce-wf-follow:hover {
  background: #bfdbfe;
}

.gce-wf-cites {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.gce-wf-cites-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.gce-wf-cite {
  border: 1px solid #86efac;
  background: #dcfce7;
  color: #166534;
  border-radius: 999px;
  padding: 5px 10px;
  font: 650 11px/1.2 inherit;
  cursor: pointer;
}

.gce-wf-cite:hover {
  background: #bbf7d0;
}

.gce-wf-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid #eef2f7;
  background: #fff;
  flex-shrink: 0;
}

.gce-wf-attach {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 12px;
  background: #f1f5f9;
  color: #64748b;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.gce-wf-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0 12px;
  font: 500 13px/1 inherit;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
}

.gce-wf-input:focus {
  border-color: #a78bfa;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}

.gce-wf-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(145deg, #1e3a8a, #5b21b6);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(91, 33, 182, 0.28);
}

.gce-wf-send:hover {
  filter: brightness(1.05);
}

/* Dark mode: keep panel readable white-on-dark chrome */
html[data-gce-mode="dark"] .gce-wf-panel,
body[data-gce-mode="dark"] .gce-wf-panel {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

html[data-gce-mode="dark"] .gce-wf-brand b,
html[data-gce-mode="dark"] .gce-wf-hello h2,
html[data-gce-mode="dark"] .gce-wf-flow h3,
html[data-gce-mode="dark"] .gce-wf-recs h3,
html[data-gce-mode="dark"] .gce-wf-step-copy b,
html[data-gce-mode="dark"] .gce-wf-rec-copy b {
  color: #f8fafc;
}

html[data-gce-mode="dark"] .gce-wf-hello p,
html[data-gce-mode="dark"] .gce-wf-step-label,
html[data-gce-mode="dark"] .gce-wf-rec-copy span {
  color: #94a3b8;
}

html[data-gce-mode="dark"] .gce-wf-head,
html[data-gce-mode="dark"] .gce-wf-composer {
  border-color: rgba(255, 255, 255, 0.08);
  background: #111827;
}

html[data-gce-mode="dark"] .gce-wf-rec,
html[data-gce-mode="dark"] .gce-wf-pill,
html[data-gce-mode="dark"] .gce-wf-input,
html[data-gce-mode="dark"] .gce-wf-attach,
html[data-gce-mode="dark"] .gce-wf-page-pill {
  background: #1f2937;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

html[data-gce-mode="dark"] .gce-wf-step--active {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(147, 197, 253, 0.35);
}

@media (max-width: 720px) {
  .gce-wf-panel {
    right: 10px;
    left: 10px;
    top: auto;
    bottom: 78px;
    width: auto;
    max-height: min(78vh, 640px);
  }

  .gce-wf-recs-grid {
    grid-template-columns: 1fr;
  }

  .gce-wf-summary {
    flex-direction: column;
    align-items: stretch;
  }
}
