/* Gemini 업무 도우미 팝업 전용 스타일 */
.union-chat-panel {
  height: min(700px, calc(100vh - 140px)) !important;
}

.union-chat-compose {
  align-items: flex-end !important;
  gap: 8px !important;
}

.union-chat-compose textarea {
  flex: 1;
  width: auto;
  min-height: 46px;
  max-height: 120px;
  padding: 12px 13px;
  border: 1px solid #d9dee8;
  border-radius: 14px !important;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: #111827;
}

.union-chat-compose textarea:focus {
  outline: none;
  border-color: #2670e8;
  box-shadow: 0 0 0 3px rgba(38, 112, 232, .15);
}

.union-chat-compose .union-chat-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #c8d8ef;
  border-radius: 14px;
  background: #eff5ff;
  color: #164da8;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.union-chat-compose .union-chat-add:hover {
  background: #e1edff;
}

.union-chat-compose .union-chat-add input {
  display: none;
}

.union-chat-compose button {
  min-height: 46px;
  padding: 0 15px;
  border-radius: 14px !important;
  background: #1768e9 !important;
}

.union-chat-compose button:disabled,
.union-chat-compose .union-chat-add.disabled {
  cursor: wait;
  opacity: .58;
}

.union-chat-files {
  padding: 9px 12px !important;
}

.union-chat-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 10px 12px 4px;
  background: #fff;
}

.union-chat-modes button {
  min-height: 45px;
  padding: 7px 5px;
  border: 1px solid #dbe4f1;
  border-radius: 12px;
  background: #f7f9fc;
  color: #44546b;
  cursor: pointer;
}

.union-chat-modes button strong,
.union-chat-modes button small {
  display: block;
  font: inherit;
}

.union-chat-modes button strong {
  font-size: 12px;
  font-weight: 900;
}

.union-chat-modes button small {
  margin-top: 2px;
  color: #697a92;
  font-size: 10px;
  font-weight: 800;
}

.union-chat-modes button.active {
  border-color: #1768e9;
  background: #eaf2ff;
  color: #1555bc;
}

.union-chat-modes button.active small {
  color: #1768e9;
}

.union-chat-mode-note {
  padding: 4px 13px 8px;
  border-bottom: 1px solid #edf1f7;
  background: #fff;
  color: #66758a;
  font-size: 11px;
  font-weight: 700;
}

.union-chat-file-chip {
  background: #ebf3ff !important;
  color: #164da8 !important;
}

.union-chat-file-chip span {
  max-width: 290px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.union-chat-privacy {
  padding: 9px 13px;
  border-top: 1px solid #edf1f7;
  background: #f8fafc;
  color: #66758a;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.union-chat-msg.loading {
  color: #64748b;
  font-weight: 700;
}

.union-chat-msg .usage {
  display: block;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

html.theme-dark .union-chat-panel,
html.theme-dark .union-chat-body {
  background: #101a2c !important;
  border-color: #293852 !important;
}

html.theme-dark .union-chat-head {
  background: linear-gradient(135deg, #10233e, #164a86) !important;
  border-color: #293852 !important;
}

html.theme-dark .union-chat-form,
html.theme-dark .union-chat-files,
html.theme-dark .union-chat-privacy,
html.theme-dark .union-chat-modes,
html.theme-dark .union-chat-mode-note {
  background: #101a2c !important;
  border-color: #293852 !important;
}

html.theme-dark .union-chat-modes button {
  background: #111f35;
  border-color: #293852;
  color: #c7d4e8;
}

html.theme-dark .union-chat-modes button small,
html.theme-dark .union-chat-mode-note {
  color: #8ea4c2;
}

html.theme-dark .union-chat-modes button.active {
  background: #172e53;
  border-color: #317af0;
  color: #e5efff;
}

html.theme-dark .union-chat-modes button.active small {
  color: #9bc0ff;
}

html.theme-dark .union-chat-msg.bot {
  background: #16243a !important;
  color: #e7eefb !important;
  border-color: #293852 !important;
}

html.theme-dark .union-chat-msg.system {
  background: #152b4e !important;
  color: #b9d4ff !important;
  border-color: #254c86 !important;
}

html.theme-dark .union-chat-msg.user {
  background: #236ce5 !important;
  color: #fff !important;
}

html.theme-dark .union-chat-compose textarea {
  background: #0c1526 !important;
  color: #e7eefb !important;
  border-color: #33445f !important;
}

html.theme-dark .union-chat-compose textarea::placeholder,
html.theme-dark .union-chat-privacy,
html.theme-dark .union-chat-msg .usage {
  color: #8ea4c2 !important;
}

html.theme-dark .union-chat-compose .union-chat-add,
html.theme-dark .union-chat-file-chip {
  background: #172e53 !important;
  color: #c3d9ff !important;
  border-color: #2c548d !important;
}

.union-chat-auto-mode{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;border:1px solid rgba(37,99,235,.18);border-radius:12px;padding:9px 11px;background:rgba(37,99,235,.07);font-size:12px;color:#1f2937}
.union-chat-auto-mode strong{font-size:13px;color:#1d4ed8}
.union-chat-auto-mode small{font-size:11px;color:#64748b;text-align:right}

/* AI markdown rendering polish */
.union-chat-msg.bot{white-space:normal!important;}
.union-chat-msg.bot h1,.union-chat-msg.bot h2,.union-chat-msg.bot h3,.union-chat-msg.bot h4,.union-chat-msg.bot h5,.union-chat-msg.bot h6{font-weight:950;color:#0f172a;line-height:1.35;margin:12px 0 8px;}
.union-chat-msg.bot h1{font-size:1.28em}.union-chat-msg.bot h2{font-size:1.2em}.union-chat-msg.bot h3{font-size:1.12em}.union-chat-msg.bot h4,.union-chat-msg.bot h5,.union-chat-msg.bot h6{font-size:1.04em}
.union-chat-msg.bot p{margin:0 0 8px;}
.union-chat-msg.bot p:last-child{margin-bottom:0;}
.union-chat-msg.bot strong{font-weight:950;color:#0f172a;}
.union-chat-msg.bot em{font-style:italic;}
.union-chat-msg.bot del{color:#64748b;}
.union-chat-msg.bot ul,.union-chat-msg.bot ol{margin:6px 0 10px 20px;padding:0;}
.union-chat-msg.bot li{margin:3px 0;padding-left:2px;}
.union-chat-msg.bot blockquote{margin:8px 0;padding:8px 10px;border-left:4px solid #cbd5e1;background:#f8fafc;color:#334155;border-radius:8px;}
.union-chat-msg.bot pre{margin:8px 0 10px;padding:10px 12px;overflow:auto;background:#0f172a;color:#e2e8f0;border-radius:12px;white-space:pre;}
.union-chat-msg.bot code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:6px;padding:1px 5px;font-size:.92em;}
.union-chat-msg.bot pre code{background:transparent;border:0;color:inherit;padding:0;font-size:.92em;}
.union-chat-msg.bot a{color:#2563eb;text-decoration:underline;text-underline-offset:2px;word-break:break-all;}
.union-chat-msg.bot hr{border:0;border-top:1px solid #e5e7eb;margin:12px 0;}
.union-chat-msg.bot .chat-md-spacer{height:6px;}
.union-chat-msg.bot .chat-md-table-wrap{overflow:auto;margin:8px 0 10px;border:1px solid #e5e7eb;border-radius:12px;}
.union-chat-msg.bot table{border-collapse:collapse;width:100%;font-size:.94em;background:#fff;}
.union-chat-msg.bot th,.union-chat-msg.bot td{border-bottom:1px solid #e5e7eb;padding:8px 10px;text-align:left;vertical-align:top;}
.union-chat-msg.bot th{background:#f8fafc;font-weight:950;color:#0f172a;}
.union-chat-msg.bot tr:last-child td{border-bottom:0;}
.union-chat-msg.bot .chat-md-check{font-weight:900;color:#334155;}
