:root {
  --bpmnbox-bg: #fafdff;
  --bpmnbox-header-bg: #f8f9fa;
  --bpmnbox-border: #e7ecef;
  --bpmnbox-shadow: 0 4px 32px #1a413733;
  --bpmnbox-title: #1c1c1c;
  --bpmnbox-msg-bg: #fff;
  --bpmnbox-msg-border: #e3e9ed;
  --bpmnbox-accent: #1c1c1c;
  --bpmnbox-link: #0d6efd;
  --bpmnbox-user: #232524;
  --bpmnbox-input-bg: #f9fafb;
  --bpmnbox-sendbtn-bg: #232524;
  --bpmnbox-sendbtn-disabled: #e3e3e3;
  --bpmnbox-sendbtn-disabled-txt: #999;
  --disclaimer-warn: #b90000;
  --chatcol-width: 380px;
}

@keyframes mc-fadein {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: none; }
}

@keyframes bpmn-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.mc-bpmnbox-overlay {
  z-index: 2147483646 !important;
  position: fixed;
  inset: 0;
  background: rgba(30, 40, 60, 0.35);
  transition: opacity 0.3s;
  display: none;
}

.mc-floating-bpmnbox,
.mc-bpmnbox-half-fullsize { z-index: 2147483647 !important; }

.mc-floating-bpmnbox,
.mc-bpmnbox-half-fullsize {
  position: fixed;
  top: 15px !important;
  left: 15px !important;
  right: 15px !important;
  bottom: 15px !important;
  display: flex;
  flex-direction: column;
  background: var(--bpmnbox-bg);
  border-radius: 18px;
  box-shadow: var(--bpmnbox-shadow);
  border: 1px solid var(--bpmnbox-border);
  overflow: hidden;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  animation: mc-fadein 0.4s;
}

.mc-floating-bpmnbox .mc-floating-header,
.mc-bpmnbox-half-fullsize .mc-floating-header {
  background: var(--bpmnbox-header-bg);
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 2px 8px rgba(60, 60, 60, 0.04);
  font-size: 1.15rem;
}

.mc-bpmnbox-title {
  font-size: 16px;
  color: var(--bpmnbox-title);
  font-weight: 500;
  letter-spacing: 0.1px;
}

.mc-floating-bpmnbox .mc-floating-actions,
.mc-bpmnbox-half-fullsize .mc-floating-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-floating-bpmnbox .mc-bpmnbox-fullscreen,
.mc-bpmnbox-half-fullsize .mc-bpmnbox-fullscreen {
  background: transparent;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  margin-right: 4px;
  padding: 0 6px;
  transition: color 0.15s;
}

.mc-floating-bpmnbox .mc-bpmnbox-fullscreen:hover,
.mc-bpmnbox-half-fullsize .mc-bpmnbox-fullscreen:hover { color: var(--bpmnbox-title); }

@media (max-width: 768px) {
  .mc-bpmnbox-fullscreen { display: none !important; }
}

.mc-floating-bpmnbox .mc-floating-close,
.mc-bpmnbox-half-fullsize .mc-floating-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px;
  transition: color 0.15s;
}

.mc-floating-bpmnbox .mc-floating-close:hover,
.mc-bpmnbox-half-fullsize .mc-floating-close:hover { color: var(--bpmnbox-title); }

.mc-chat-toggle {
  background: #fff;
  border: 1px solid #d4d6da;
  color: #333;
  font-size: 14px;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  min-width: 125px;
}

.mc-chat-toggle:hover,
.mc-chat-toggle:focus {
  background: #f4f6f8;
  border-color: #b8bdc6;
  color: #000;
}

.mc-bpmnbox-content-row { display: flex; height: 100%; min-height: 0; }
.mc-bpmnbox-editorcol { display: flex; flex-direction: row; height: 100%; min-width: 0; flex: 1 1 0%; }

.bpmn-toolbox {
  width: 70px; min-width: 70px; max-width: 70px; flex-shrink: 0;
  background: #f7f7f7; border-right: 1px solid #e1e1e1;
  display: flex; flex-direction: column; z-index: 10; align-items: center; padding-top: 10px;
}

#mc-bpmnbox-bpmn-wrapper {
  flex: 1 1 0%;
  min-width: 0;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

#mc-bpmnbox-bpmn {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  width: 100%;
  background: #fafbfc;
  position: relative;
}

.mc-bpmnbox-chatcol {
  width: var(--chatcol-width);
  min-width: 280px;
  max-width: 420px;
  background: #fff;
  border-left: 1px solid #e7ecef;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, min-width 0.25s ease, max-width 0.25s ease, border-left-color 0.25s ease, visibility 0.25s ease;
}

.mc-floating-bpmnbox.is-chat-collapsed .mc-bpmnbox-chatcol {
  width: 0; min-width: 0; max-width: 0;
  border-left-color: transparent;
  visibility: hidden;
  pointer-events: none;
}

.mc-bpmnbox-window {
  background: #fff;
  border: 1px solid #e3e9ed;
  border-radius: 12px;
  flex: 1 1 auto;
  min-height: 120px;
  padding: 20px 14px;
  margin: 12px 14px 0 14px;
  overflow-y: auto;
  font-size: 1.09rem;
  box-shadow: 0 1px 3px #0001;
  transition: border 0.2s;
  display: flex;
  flex-direction: column;
}

.mc-bpmnbox-message { margin-bottom: 9px; align-items: flex-start; }
.mc-bpmnbox-author { font-weight: 600; white-space: nowrap; color: #000; }

.mc-msg-user, .mc-msg-gpt {
  justify-content: flex-start;
  color: var(--bpmnbox-user);
  font-size: 15px;
  line-height: 1.25;
}

.mc-bpmnbox-form { flex-direction: column; gap: 14px; align-items: stretch; margin: 16px 14px 12px 14px; }
.mc-bpmnbox-input-group { display: flex; flex-direction: column; gap: 12px; max-width: 450px; margin: 0 auto; }

.mc-bpmnbox-input {
  resize: none;
  min-height: 90px;
  max-height: 240px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #e3e9ed;
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
  width: 100%;
  background: var(--bpmnbox-input-bg);
}

.mc-bpmnbox-actionrow {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin: 2px 0 0 !important;
  gap: 0 !important;
  width: 100% !important;
}

.mc-bpmnbox-sendbtn {
  align-self: center;
  min-width: 96px;
  width: auto;
  padding: 4px 12px;
  border-radius: 9px;
  font-size: 16px;
  font-family: inherit;
  background: var(--bpmnbox-sendbtn-bg);
  color: #fff;
  border: none;
  box-shadow: 0 1px 3px #0001;
  cursor: pointer;
  transition: background 0.18s;
}

.mc-bpmnbox-sendbtn:hover,
.mc-bpmnbox-sendbtn:active,
.mc-bpmnbox-sendbtn:focus { background: #232524; color: #fff; }

.mc-bpmnbox-sendbtn:disabled {
  background: var(--bpmnbox-sendbtn-disabled);
  color: var(--bpmnbox-sendbtn-disabled-txt);
  cursor: not-allowed;
  opacity: 0.65;
}

.mc-bpmnbox-counter { font-size: 0.7em !important; color: #868686 !important; white-space: nowrap !important; margin-left: 0 !important; }

.mc-bpmnbox-hint { text-align: center; font-size: 0.93em; color: var(--bpmnbox-title); margin: 4px 0 10px; }
.mc-bpmnbox-hint small { font-size: 12px; }

.bpmnbot-disclaimer { display: block; font-size: 12px; line-height: 1.25; color: var(--bpmnbox-title); text-align: center; margin: 12px 0 6px; }

.bpmnbot-disclaimer a { color: var(--bpmnbox-title); text-decoration: underline; transition: color 0.15s; }
.bpmnbot-disclaimer a:hover { color: var(--bpmnbox-title); }

.mc-disclaimer-row { width: 100%; display: flex; align-items: center; gap: 10px; margin: 0 0 4px 0; min-height: 26px; position: relative; }
.mc-slider-center { display: flex; justify-content: center; width: 100%; margin: 0; }

#mc-bpmnbox-disclaimer-toggle { display: none; }

#mc-bpmnbox-disclaimer-hint {
  min-width: 80px; font-size: 14px; margin-left: 7px; line-height: 1.2;
  transition: opacity 0.18s; opacity: 1; pointer-events: auto; height: 14px; display: inline-block; vertical-align: middle;
}

#mc-bpmnbox-disclaimer-hint.is-invisible { opacity: 0; pointer-events: none; }

.mc-slider-label {
  width: 36px; height: 20px; background: #ccc; border-radius: 18px; position: relative;
  display: inline-block; cursor: pointer; transition: background 0.2s; margin: 0;
}

.mc-slider-label::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: left 0.2s;
}

#mc-bpmnbox-disclaimer-toggle:checked ~ .mc-slider-label { background: var(--bpmnbox-accent); }
#mc-bpmnbox-disclaimer-toggle:checked ~ .mc-slider-label::before { left: 18px; background: #e0e0e0; }
#mc-bpmnbox-disclaimer-toggle:checked ~ #mc-bpmnbox-disclaimer-hint { opacity: 0; pointer-events: none; width: 0; min-width: 0; margin: 0; }

.mc-disclaimer-row.centered { justify-content: center; }

.bpmn-controls { margin-top: 10px; margin-left: 10px; display: flex; gap: 6px; }
.bpmn-controls button {
  padding: 4px 6px; font-size: 14px; background: #f4f6fb; color: #181c27;
  border: 1px solid #b0b8ca; border-radius: 5px; cursor: pointer; transition: background 0.2s;
}
.bpmn-controls button:hover { background: #e1e6f3; border-color: #0d6efd; color: #0d6efd; }

.bpmn-loader {
  position: absolute; z-index: 2147483640 !important; left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.85); display: flex; align-items: center; justify-content: center;
}

.bpmn-loader-content { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.bpmn-canvas-spinner {
  position: absolute; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; background: transparent; pointer-events: all;
}

.bpmn-spinner {
  width: 72px; height: 72px; border: 10px solid #d6d6d6; border-top: 10px solid #3399ff; border-radius: 50%;
  animation: bpmn-spin 1.2s linear infinite; margin-bottom: 12px;
}

.mc-link-safe,
.mc-bpmnbox-window a,
#mc-bpmnbox-debugpanel a { color: var(--bpmnbox-link) !important; text-decoration: underline !important; cursor: pointer !important; }

#bpmn-file-input {
  display: none;
}

#mc-bpmnbox-debugpanel {
  margin-top: 14px;
}

#mc-bpmnbox-debugpanel > div {
  border: 1px solid #ddd;
  padding: 8px;
  font-size: 13px;
}

#debug-bpmn-xml {
  white-space: pre-wrap;
}

.mc-bpmnbox-text { font-size: 15px; color: #000; }

svg .djs-label text { paint-order: stroke; stroke: #fff; stroke-width: 3px; }

.bpmnbox-openbtn {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: var(--bpmnbox-accent);
  color: #fff;
  border: none;
  border-radius: 18px 0 0 18px;
  width: 44px;
  padding: 22px 0;
  font-size: 16px;
  font-weight: 500;
  box-shadow: -4px 0 14px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s, background 0.15s, box-shadow 0.15s;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.01em;
  display: block;
  text-align: center;
}

.bpmnbox-openbtn:hover {
  opacity: 1;
  background: #232524;
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.35);
}

.mc-bpmnbox-openbtn {
  position: static;
  margin: 0;
  right: auto;
  top: auto;
  transform: none;
  background: var(--bpmnbox-accent);
  color: #fff;
  border: none;
  border-radius: 18px 0 0 18px;
  width: 44px;
  padding: 22px 0;
  font-size: 1.03rem;
  font-weight: 500;
  box-shadow: -4px 0 14px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s, background 0.15s, box-shadow 0.15s;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.01em;
  display: block;
  text-align: center;
}

.mc-bpmnbox-openbtn:hover {
  opacity: 1;
  background: #232524;
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.35);
}

#mc-bpmnbox-debugpanel pre { min-height: 80px; max-height: 80px; overflow-y: auto; white-space: pre-wrap; }
@media (min-width: 768px) { #mc-bpmnbox-debugpanel pre { min-height: 50px; max-height: 50px; } }
@media (min-width: 1920px) { #mc-bpmnbox-debugpanel pre { min-height: 150px; max-height: 150px; } }

@media (max-width: 1100px) {
  .mc-bpmnbox-chatcol { min-width: 180px; max-width: none; width: 40%; }
}

@media (max-width: 900px) {
  .mc-bpmnbox-content-row, .mc-bpmnbox-editorcol { flex-direction: column; }
  .bpmn-toolbox {
    flex-direction: row; width: 100%; min-width: 0; max-width: none; border-right: none; border-bottom: 1px solid #e1e1e1;
    justify-content: center; padding: 0 0 10px;
  }
  #mc-bpmnbox-bpmn-wrapper { min-height: 300px; }
  .mc-bpmnbox-chatcol {
    width: 100%; min-width: 0; max-width: none; border-left: none; transition: max-height 0.25s ease;
  }
  .mc-floating-bpmnbox.is-chat-collapsed .mc-bpmnbox-chatcol { max-height: 0; height: 0; }
}

@media (max-width: 768px) {
  .mc-floating-bpmnbox, .mc-bpmnbox-half-fullsize {
    top: 2vw !important; left: 2vw !important; right: 2vw !important; bottom: 2vw !important; border-radius: 12px !important; padding: 0 !important; margin: 0 !important;
  }
  .mc-bpmnbox-content-row { flex-direction: column; }
  .mc-bpmnbox-chatcol { width: 100%; min-width: 0; max-width: none; border-left: none; }
  #mc-bpmnbox-messages {
    display: none !important; visibility: hidden !important; height: 0 !important; min-height: 0 !important; max-height: 0 !important;
    padding: 0 !important; margin: 0 !important; overflow: hidden !important;
  }
  #mc-bpmnbox-input {
    min-height: 80px !important; max-height: 80px !important; height: 80px !important;
    font-size: 15px !important; line-height: 1.2 !important; resize: none !important;
  }
  .mc-bpmnbox-actionrow { margin: 1px 0 0 !important; gap: 0 !important; width: 100% !important; }
  .mc-bpmnbox-sendbtn { font-size: 0.86rem !important; min-width: 74px !important; height: 28px !important; padding: 3px 8px !important; }
  .mc-bpmnbox-counter { font-size: 0.65em !important; }
  .mc-bpmnbox-fullscreen { display: none !important; }
  .mc-slider-label { width: 32px; height: 17px; }
  .mc-slider-label::before { width: 13px; height: 13px; }
}

.overlay { display: none; position: fixed; inset: 0; z-index: 1000; justify-content: center; align-items: center; }
.overlay-background { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); }
.overlay-content {
  position: relative; background: #fff; color: #000; padding: 1.5em; max-width: 600px;
  border-radius: 0.5em; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); text-align: left; font-size: 0.95em; line-height: 1.4; height: auto; overflow: visible; margin: 0;
}
.overlay-content h2 { margin-top: 0; font-size: 1.2em; }
.overlay-copybtn { margin-top: 1em; padding: 0.5em 1em; border: none; border-radius: 0.3em; cursor: pointer; font-size: 0.9em; background: #232525; color: #fff; }

.mc-bpmnbox-demolink {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--bpmnbox-link);
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
  line-height: 1.2;
  font-size: 15px;
  margin-bottom: 5px;
}
.mc-bpmnbox-demolink:focus { outline: 2px solid #aac7ff; outline-offset: 2px; }

.mc-bpmnbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  margin: 6px 0;
}

.mc-bpmnbox-toolbar-spacer { flex: 1 1 auto; }

.overlay-cancel-link {
  font-size: 15px;
  text-decoration: underline;
}

.overlay-actions {
  gap: 1rem;
}