

:root {
  --accent: #4F46E5;
  --accent_light: #FF859C;
  --accent_dark: #312E81;
  --border: #262626;
  --bg: #FFFFFF;
  --radius: 5px;
  --border_w: 3px;
  --danger:#F44336;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background-color:#f4f4f4;
  margin:0;
  font-family:Arial, sans-serif;
  color:var(--text);
}

body, input, select, textarea, button, pre {
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-color: #262626;
}

button:disabled {
  opacity: 0.5;  
  cursor: not-allowed; 
}

button.running:disabled {
  opacity: 1;
  cursor: default;
}

.container {
  max-width:1000px;
  width:min(1000px, calc(100% - 24px));
  margin:20px auto;
  background:#F1F1F1;
  padding:20px;
  border:var(--border_w) solid var(--border);
  border-radius:var(--radius);
  text-align:center;
  box-shadow:0 4px 12px rgba(0,0,0,0.3);
}

h1, h2, h3 {
  text-align: center;
  color: #333;
}

label {
  display: block;
  margin-top: 10px;
  color:#262626;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="time"],
select {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 3px solid #262626;
  border-radius: 5px;
  box-sizing: border-box;
  background-color: #FFFFFF;
  color: #262626;
}

#download-section .download-form-grid {
  width: min(100%, 900px);
  margin: 14px auto 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 14px;
  align-items: end;
}

#download-section .download-field {
  min-width: 0;
}

#download-section .download-field label {
  display: block;
  margin: 0 0 6px;
  text-align: left;
  font-weight: 600;
}

#download-section .download-field input,
#download-section .download-field select {
  width: 100%;
  margin: 0;
}

@media (max-width: 520px) {
  .container {
    width: calc(100% - 12px);
    margin: 6px auto;
    padding: 12px;
  }

  #download-section .download-form-grid {
    grid-template-columns: 1fr;
  }
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
  border-color: #262626;
  background-color: #FF4F71;  
  outline: none;   
}

textarea {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 3px solid #262626;
  border-radius: 5px;
  box-sizing: border-box;
  resize: vertical;
}

.buttons {
  text-align: center;
  margin: 10px 0;
}

button {
  padding: 10px 20px;
  margin: 10px 5px;
  border-radius: 5px;
  border: 3px solid #262626;
  background-color: #ffffff;
  color: #262626;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
}

button:hover {
  border: 3px solid #262626;
  background-color: #262626;
  color: #ffffff;
}

#download-btn.running {
  background-color: #FF1744;
  font-weight: bold;
  color: #262626;
}

#analyse-form button.running,
#start-sediment-btn.running {
  background-color: #FF1744;
  font-weight: bold;
  color: #262626;
}

.upload-area {
  border: 3px dashed #262626;  
  background-color: #ffffff;     
  padding: 20px;
  text-align: center;
  margin: 10px 0;
  cursor: pointer;
  border-radius: 8px; 
}
.upload-area.dragover {
  background-color: #BDBDBD;
  border: 3px solid #FF1744;   
}

.result-container {
  display: none;
  background-color: #FF1744;
  border: 3px solid #262626;
  padding: 15px;
  border-radius: 8px;
  color: #262626;
  margin: 20px auto 0 auto;
  width: min(100%, 900px);
  box-sizing: border-box;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-weight: bold;
  word-break: break-word;
  text-align: left;
  transition: opacity 0.25s ease;
}

.result-container.status-success {
  text-align: center;
}

.result-container.status-success strong {
  font-weight: 700;
}

progress {
  width: 100%;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  border: 3px solid #262626;
  border-radius: 0;
  overflow: hidden;
}

.section {
  margin-bottom: 40px;
}

.spinner {
  border: 8px solid #262626;
  border-top: 8px solid #FF1744;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

.progress-details {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-line;
}

.process-topbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:14px;
}

.process-title {
  font-size:22px;
  font-weight:600;
  letter-spacing:.06em;
  text-transform:uppercase;
  text-align:center;
  color:#262626;
}

.process-id {
  font-size:14px;
  font-weight:600;
  color:#FF1744;
}

.process-action-row {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  width:100%;
  margin:0 auto 16px auto;
  flex-wrap:wrap;
}

.process-icon-btn {
  width:48px;
  height:48px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#FFFFFF;
  border:3px solid #262626;
  border-radius:8px;
  text-decoration:none;
  transition:background-color 0.2s ease, border-color 0.2s ease;
  position:relative;
  padding:0;
  margin:0;
  box-sizing:border-box;
  cursor:pointer;
  flex-shrink:0;
  appearance:none;
  -webkit-appearance:none;
  line-height:1;
  font:inherit;
  vertical-align:middle;
}

.process-icon-btn:hover {
  background:#FF1744;
  border-color:#262626;
}

.process-icon-btn:hover .process-icon {
  background-color:#262626;
}

.process-icon {
  width:24px;
  height:24px;
  display:inline-block;
  background-color:#262626;
  transition:background-color 0.2s ease;
  mask-repeat:no-repeat;
  -webkit-mask-repeat:no-repeat;
  mask-position:center;
  -webkit-mask-position:center;
  mask-size:contain;
  -webkit-mask-size:contain;
}

.process-icon-back {
  mask-image:url('/static/icons/arrow-left-to-line.svg');
  -webkit-mask-image:url('/static/icons/arrow-left-to-line.svg');
}

.process-icon-save {
  mask-image:url('/static/icons/save.svg');
  -webkit-mask-image:url('/static/icons/save.svg');
}

.process-icon-random {
  mask-image:url('/static/icons/dice-6.svg');
  -webkit-mask-image:url('/static/icons/dice-6.svg');
}

.process-icon-help {
  mask-image:url('/static/icons/message-circle-question-mark.svg');
  -webkit-mask-image:url('/static/icons/message-circle-question-mark.svg');
}

.process-icon-search {
  mask-image:url('/static/icons/search.svg');
  -webkit-mask-image:url('/static/icons/search.svg');
}

.process-icon-upload {
  mask-image:url('/static/icons/upload.svg');
  -webkit-mask-image:url('/static/icons/upload.svg');
}

.process-icon-refresh {
  mask-image:url('/static/icons/rotate-ccw.svg');
  -webkit-mask-image:url('/static/icons/rotate-ccw.svg');
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0, 0, 0, 0);
  white-space:nowrap;
  border:0;
}

@media (max-width: 640px) {
  .process-topbar {
    flex-direction:column;
    align-items:center;
    justify-content:center;
  }

  .process-title {
    width:100%;
    text-align:center;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

progress::-webkit-progress-bar {
  background-color: #eee;
  border: none;
}

progress::-webkit-progress-value {
  background-color: #FF1744;
}

progress::-moz-progress-bar {
  background-color: #FF1744
}

.form-field {
  min-width: 0;
  text-align: left;
}

.form-field label {
  display: block;
  margin: 0 0 6px 0;
  text-align: left;
  font-weight: 600;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
  width: 100%;
  margin: 0;
}

.title-field {
  width: min(100%, 900px);
  margin: 0 auto 14px auto;
  text-align: center;
}

.title-field label {
  display: block;
  margin: 10px 0 6px 0;
  font-weight: 600;
  text-align: left;
}

.title-field input[type="text"] {
  width: 100%;
  margin: 0;
}

.prompt-grid {
  width: min(100%, 900px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 14px;
  align-items: stretch;
}

.prompt-grid textarea {
  min-height: 150px;
}

.bot-config-grid {
  width: min(100%, 900px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px;
  align-items: end;
}

.kb-control-row {
  width: min(100%, 900px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 1fr) minmax(160px, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.kb-file-form {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 106px;
  align-self: start;
  padding-top: calc(1em + 5px);
}

.kb-file-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.kb-hidden-file {
  display: none;
}

.kb-selected-file {
  width: min(100%, 900px);
  max-width: 900px;
  margin: -4px auto 14px auto;
  font-size: 12px;
  color: #666;
  line-height: 1.3;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-control-row {
  width: min(100%, 900px);
  margin: 14px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  justify-content: center;
}

.share-control-row,
.share-control-row * {
  box-sizing: border-box;
}

.share-control-row .form-field {
  margin: 0;
  padding: 0;
  min-width: 0;
}

.share-main-field {
  flex: 1 1 220px;
  max-width: 320px;
}

.share-days-field {
  flex: 0 1 260px;
}

.share-time-field {
  flex: 0 0 88px;
  max-width: 88px;
}

.share-message-field {
  flex: 1 1 420px;
  min-width: 320px;
  max-width: none;
}

.share-control-row label {
  display: block;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.share-control-row select,
.share-control-row input[type="password"],
.share-control-row input[type="text"],
.share-control-row input[type="time"] {
  width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0 14px;
  border: 3px solid #262626;
  border-radius: 5px;
  box-sizing: border-box;
  background-color: #FFFFFF;
  color: #262626;
  font: inherit;
  line-height: 1;
}

.share-password-row input[type="password"],
.share-password-row input[type="text"] {
  width: auto;
}

.share-control-row select:focus,
.share-control-row input[type="password"]:focus,
.share-control-row input[type="text"]:focus,
.share-control-row input[type="time"]:focus {
  border-color: #262626;
  background-color: #FF4F71;
  outline: none;
}

.share-enabled-field {
  flex: 0 0 170px;
  max-width: 170px;
  min-width: 150px;
}

.share-availability-field {
  flex: 0 0 230px;
  max-width: 230px;
  min-width: 210px;
}

.share-password-field {
  flex: 1 1 430px;
  min-width: 320px;
  max-width: 560px;
}

.share-password-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.share-password-row input[type="password"],
.share-password-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

#share-password.has-password::placeholder {
  color: #262626;
  opacity: 1;
  letter-spacing: .12em;
}

.share-password-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.share-password-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: #262626;
  cursor: pointer;
  line-height: 0;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
}

.share-password-icon::before {
  content: "";
  width: 28px;
  height: 28px;
  display: block;
  flex: 0 0 28px;
  background-color: currentColor;
  pointer-events: none;

  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}

.share-password-toggle::before {
  -webkit-mask-image: url("/static/icons/eye-closed.svg");
          mask-image: url("/static/icons/eye-closed.svg");
}

.share-password-toggle.is-visible::before {
  -webkit-mask-image: url("/static/icons/eye.svg");
          mask-image: url("/static/icons/eye.svg");
}

.share-password-save::before {
  -webkit-mask-image: url("/static/icons/save.svg");
          mask-image: url("/static/icons/save.svg");
}

.share-password-delete::before {
  -webkit-mask-image: url("/static/icons/trash.svg");
          mask-image: url("/static/icons/trash.svg");
}

.share-password-icon:hover,
.share-password-icon:focus-visible {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none;
  border: 0 !important;
  color: #FF1744;
  outline: none;
}

.share-password-icon:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.share-password-icon:disabled:hover {
  color: #262626;
}

.share-day-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  min-height: 48px;
}

.share-day-label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.share-day {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #262626;
  cursor: pointer;
}

.share-time-field input[type="time"] {
  width: 88px;
  min-width: 0;
  padding: 0 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.share-message-field input[type="text"] {
  width: 100%;
}


.share-time-field input[type="time"],
.share-message-field input[type="text"] {
  height: 48px;
  margin: 0;
}

.share-time-field input[type="time"] {
  padding: 10px 8px;
  text-align: center;
}

.share-action-form {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
  flex: 0 0 48px;
  min-width: 48px;
  align-self: start;
  padding-top: calc(1.2em + 8px);
  margin: 0;
}

.share-control-row .process-icon-btn {
  margin: 0;
}

.share-cost-note[hidden] {
  display: none !important;
}

.embed-code-grid {
  width: min(100%, 900px);
  margin: 14px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 14px;
  align-items: stretch;
}

.embed-code-grid textarea {
  min-height: 120px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.share-explain {
  width: min(100%, 900px);
  margin: 8px auto 14px auto;
  font-size: 14px;
  line-height: 1.45;
  color: #444;
  text-align: center;
}

.share-cost-note {
  width: min(100%, 900px);
  margin: 0 auto 14px auto;
  padding: 10px 10px;
  border: 3px solid #FF1744;
  border-radius: 5px;
  background: #FFFFFF;
  color: #262626;
  font-size: 12.5px;
  line-height: 1.2;
  text-align: center;
  box-sizing: border-box;
}

.share-cost-note strong {
  color: #FF1744;
}

.share-output-grid {
  width: min(100%, 900px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.share-card {
  border: 3px solid #262626;
  border-radius: 10px;
  background: #ffffff;
  padding: 14px;
  text-align: left;
  box-sizing: border-box;
}

.share-card-wide {
  grid-column: 1 / -1;
}

.share-card-title {
  font-weight: 700;
  font-size: 15px;
  color: #262626;
  margin-bottom: 6px;
}

.share-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.share-card-header .share-card-title {
  margin-bottom: 0;
}

.share-code-copy-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #262626;
  cursor: pointer;
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
}

.share-code-copy-btn::before {
  content: "";
  width: 20px;
  height: 20px;
  display: block;
  background-color: currentColor;

  mask-image: url('/static/icons/copy.svg');
  -webkit-mask-image: url('/static/icons/copy.svg');

  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;

  mask-position: center;
  -webkit-mask-position: center;

  mask-size: contain;
  -webkit-mask-size: contain;
}

.share-code-copy-btn:hover,
.share-code-copy-btn:focus-visible {
  color: #FF1744;
  background: transparent !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.share-code-copy-btn.is-copied {
  color: #FF1744;
}

.share-card-hint {
  font-size: 12px;
  line-height: 1.4;
  color: #666;
  margin: 0 0 10px 0;
}

.share-card textarea {
  width: 100%;
  min-height: 130px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}

.share-url-input {
  width: 100%;
  box-sizing: border-box;
  border: 3px solid #262626;
  border-radius: 5px;
  padding: 10px;
  font-size: 14px;
  color: #262626;
  background: #ffffff;
}

.qr-preview-box {
  min-height: 230px;
  border: 3px dashed #262626;
  border-radius: 10px;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

.share-qr-img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  display: block;
  background: #ffffff;
  border-radius: 8px;
}

.share-qr-placeholder {
  color: #666;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.share-qr-download {
  display: inline-block;
  margin-top: 10px;
  color: #FF1744;
  font-size: 13px;
  text-decoration: none;
  font-weight: 700;
}

.share-qr-download:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .share-output-grid {
    grid-template-columns: 1fr;
  }

  .share-card-wide {
    grid-column: auto;
  }
}

.share-qr-img[hidden],
.share-qr-placeholder[hidden],
.share-qr-download[hidden] {
  display: none !important;
}

.process-icon-btn.is-disabled,
.process-icon-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.process-icon-btn.is-disabled:hover,
.process-icon-btn:disabled:hover {
  background: #FFFFFF;
  border-color: #262626;
}

@media (max-width: 900px) {
  .kb-control-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kb-file-form {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .kb-selected-file {
    max-width: min(100%, 900px);
    text-align: center;
  }
}

@media (max-width: 720px) {
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .kb-control-row {
    grid-template-columns: 1fr;
  }

  .kb-file-form {
    justify-content: center;
  }

  .kb-selected-file {
    text-align: center;
    white-space: normal;
  }
  
  .share-control-row {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    max-width: 100%;
  }

  .share-control-row .form-field,
  .share-enabled-field,
  .share-availability-field,
  .share-password-field,
  .share-main-field,
  .share-days-field,
  .share-time-field,
  .share-message-field,
  .share-action-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    align-self: stretch;
    box-sizing: border-box;
  }

  .share-password-row {
    width: 100%;
    min-width: 0;
  }

  .share-password-row input[type="password"],
  .share-password-row input[type="text"] {
    width: auto;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    box-sizing: border-box;
  }

  .share-control-row select,
  .share-time-field input[type="time"],
  .share-message-field input[type="text"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .share-time-field input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
  }

  .share-action-form {
    justify-content: center;
    padding-top: 0;
  }

  .share-control-row .process-icon-btn {
    margin-top: 0;
  }
}

.chat-window {
  width: 100%;
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  background: #ffffff;
  border: 3px solid #262626;
  border-radius: 10px;
  padding: 14px;
  text-align: left;
}

.chat-message {
  margin: 12px 0;
  color: #262626;
}

.chat-message.assistant {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-label {
  font-size: 13px;
  font-weight: bold;
  color: #262626;
  margin-bottom: 1px;
}

.chat-message.assistant .chat-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-message.assistant .chat-label::before {
  content: "";
  width: 24px;
  height: 24px;
  display: inline-block;
  background-color: #262626;
  transform: translateY(-2px);

  mask-image: url('/static/icons/bot.svg');
  -webkit-mask-image: url('/static/icons/bot.svg');

  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;

  mask-position: center;
  -webkit-mask-position: center;

  mask-size: contain;
  -webkit-mask-size: contain;
}

.chat-bubble {
  display: inline-block;
  max-width: min(760px, 100%);
  padding: 10px 12px;
  border-radius: 5px;
  border: 2px solid #262626;
  background: #f7f7ff;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.45;
}

.chat-message.assistant .chat-bubble {
  position: relative;
  padding-bottom: 34px;
}

.chat-copy-btn {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #262626;
  cursor: pointer;
  line-height: 1;
}

.chat-copy-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  display: block;
  background-color: currentColor;

  mask-image: url('/static/icons/copy.svg');
  -webkit-mask-image: url('/static/icons/copy.svg');

  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;

  mask-position: center;
  -webkit-mask-position: center;

  mask-size: contain;
  -webkit-mask-size: contain;
}

.chat-copy-btn:hover,
.chat-copy-btn:focus-visible {
  color: #FF1744;
  background: transparent !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.chat-copy-btn.is-copied {
  color: #FF1744;
}

.chat-bubble p {
  margin: 0 0 0.75em 0;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-bubble ul,
.chat-bubble ol {
  margin: 0.4em 0 0.8em 1.4em;
  padding: 0;
}

.chat-bubble li {
  margin: 0.25em 0;
}

.chat-bubble code {
  font-family: Consolas, "Courier New", monospace;
  background: #f1f1f1;
  padding: 1px 4px;
  border-radius: 4px;
}

.chat-bubble pre {
  white-space: pre-wrap;
  overflow-x: auto;
  background: #f1f1f1;
  padding: 10px;
  border-radius: 5px;
}

.chat-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 8px 0;
}

.chat-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
}

.chat-table th,
.chat-table td {
  border: 1px solid #262626;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.chat-table th {
  font-weight: bold;
  background: #f1f1f1;
}

.chat-message.user {
  text-align: right;
}

.chat-message.user .chat-bubble {
  background: var(--accent_light);
}

.chat-message.assistant .chat-bubble {
  background: #ffffff;
}

.chat-message.assistant.chat-thinking .chat-bubble {
  background: #fff7f9;
  color: #262626;
}

.chat-thinking-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.chat-thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FF1744;
  display: inline-block;
  animation: byocThinkingPulse 1s infinite ease-in-out;
}

.chat-thinking-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-thinking-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes byocThinkingPulse {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chat-window,
.chat-window *,
.chat-input-row textarea {
  color: #262626;
}

.chat-message.user .chat-bubble,
.chat-message.assistant .chat-bubble,
.chat-label {
  color: #262626;
}

.chat-bubble {
  color: #262626;
  font-size: 16px;
  line-height: 1.45;
}

.chat-bubble p {
  color: #262626;
  font-size: 16px;
  line-height: 1.45;
}

.chat-heading {
  color: #262626;
  font-weight: 700;
  line-height: 1.35;
  margin: 0.9em 0 0.35em 0;
}

.chat-heading:first-child {
  margin-top: 0;
}

.chat-heading-1 {
  font-size: 17px;
}

.chat-heading-2,
.chat-heading-3 {
  font-size: 16px;
}

.chat-bubble strong,
.chat-bubble em,
.chat-bubble li,
.chat-bubble td,
.chat-bubble th {
  color: #262626;
}

.chat-input-row {
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  margin-top:12px;
}

.chat-input-row textarea {
  width:100%;
  min-height:100px;
  margin:0;
  display:block;
}

.chat-input-row textarea::placeholder {
  color: #262626;
  opacity: 1;
}

.chat-input-row textarea:focus::placeholder {
  color: #ffffff;
  opacity: 1;
}

.chat-tool-row {
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}

.chat-send-btn,
.chat-action-btn {
  width:48px;
  height:48px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#FFFFFF;
  border:3px solid #262626;
  border-radius:8px;
  padding:0;
  margin:0;
  box-sizing:border-box;
  cursor:pointer;
  line-height:1;
  flex:0 0 48px;
  text-decoration:none;
}

.chat-send-btn:hover,
.chat-action-btn:hover {
  background:#FF1744;
  border-color:#262626;
}

.chat-send-btn:disabled {
  opacity:.55;
  cursor:not-allowed;
}

.chat-send-btn:disabled:hover {
  background:#FFFFFF;
  border-color:#262626;
}

.chat-send-btn:hover {
  background: #FF1744;
  border-color: #262626;
}

.chat-send-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.chat-send-btn:disabled:hover {
  background: #FFFFFF;
  border-color: #262626;
}

.chat-send-icon {
  width: 26px;
  height: 26px;
  display: block;
  background-color: #262626;

  mask-image: url('/static/icons/message-circle-more.svg');
  -webkit-mask-image: url('/static/icons/message-circle-more.svg');

  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;

  mask-position: center;
  -webkit-mask-position: center;

  mask-size: contain;
  -webkit-mask-size: contain;
}

.chat-action-icon {
  width:26px;
  height:26px;
  display:block;
  background-color:#262626;

  mask-repeat:no-repeat;
  -webkit-mask-repeat:no-repeat;

  mask-position:center;
  -webkit-mask-position:center;

  mask-size:contain;
  -webkit-mask-size:contain;
}

.chat-action-icon-back {
  mask-image:url('/static/icons/arrow-left-to-line.svg');
  -webkit-mask-image:url('/static/icons/arrow-left-to-line.svg');
}

.chat-action-icon-config {
  mask-image:url('/static/icons/cpu.svg');
  -webkit-mask-image:url('/static/icons/cpu.svg');
}

.embed-body {
  background:transparent;
  margin:0;
}

.embed-chat-shell {
  width:100%;
  min-height:100%;
  background:#f4f4f4;
  border:0;
  padding:16px;
  box-sizing:border-box;
}

.private-chat-body {
  min-height:100dvh;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:24px 12px;
  background:#f4f4f4;
}

.private-chat-shell {
  width:min(920px, 96vw);
  min-height:auto;
  background:#FFFFFF;
  border:3px solid #262626;
  border-radius:10px;
  padding:18px;
  box-shadow:0 4px 12px rgba(0,0,0,.22);
}

.private-chat-body #embed-chat-content {
  width:100%;
  max-width:860px;
  margin:0 auto;
}

.private-chat-body .chat-window {
  min-height:320px;
  max-height:52vh;
}

.private-chat-body .embed-ai-notice {
  max-width:820px;
}

.embed-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 14px;
}

.embed-app-logo {
  width: 78px;
  height: 78px;
  object-fit: contain;
  display: block;
}

.embed-title {
  margin: 0;
  color: #262626;
  font-size: 20px;
  line-height: 1.2;
}

.embed-description {
  margin: 0;
}

.embed-ai-notice {
  width: 100%;
  margin: 16px auto 0 auto;
  padding: 10px 12px;
  color: #262626;
  font-size: 10px;
  line-height: 1.20;
  text-align: center;
}

.embed-footer {
  text-align: center;
  font-size: 12px;
  margin-top: 16px;
  color: #262626;
  line-height: 1.45;
}

.embed-footer a {
  color: #FF1744;
  text-decoration: none;
  margin: 0 4px;
}

.embed-footer a:hover {
  text-decoration: underline;
}

.embed-password-gate {
  margin: 14px 0;
}

.embed-password-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.embed-password-row input {
  flex: 1 1 220px;
}

.kb-existing {
  width: min(100%, 900px);
  max-width: 900px;
  margin: 16px auto 0 auto;
  border: 3px solid #262626;
  border-radius: 5px;
  padding: 12px;
  background: #fff;
  box-sizing: border-box;
}

.kb-existing-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  color: #262626;
}

.kb-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #262626;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  appearance: none;
  -webkit-appearance: none;
}

.kb-icon-btn:hover,
.kb-icon-btn:focus-visible {
  color: #FF1744;
  background: transparent !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.kb-icon-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.kb-icon-btn:disabled:hover {
  color: #262626;
}

.kb-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  background-color: currentColor;
  transition: background-color 0.2s ease;

  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: contain;
  -webkit-mask-size: contain;
}

.kb-icon-refresh {
  mask-image: url('/static/icons/rotate-ccw.svg');
  -webkit-mask-image: url('/static/icons/rotate-ccw.svg');
}

.kb-icon-remove {
  mask-image: url('/static/icons/circle-x.svg');
  -webkit-mask-image: url('/static/icons/circle-x.svg');
}

.kb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  padding: 10px;
}

.kb-list-main {
  min-width: 0;
}

.kb-list-meta {
  margin-top: 4px;
  font-size: 13px;
  color: #555;
}

.kb-empty {
  color: #555;
  font-size: 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  z-index: 9999;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  width: min(520px, 92vw);
  background: #FFFFFF;
  border: var(--border_w) solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  padding: 16px 16px 14px 16px;
  text-align: left;
}

#botOptionsOverlay .modal.modal-wide {
  width: min(1000px, calc(100vw - 72px));
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 24px 16px 24px;
}

#botOptionsOverlay .modal-option-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 26px;
  margin: 12px 0 0 0;
  padding-left: 22px;
  line-height: 1.20;
}

#botOptionsOverlay .modal-option-list li {
  break-inside: avoid;
}

#botOptionsOverlay .modal-actions {
  margin-top: 16px;
}

@media (max-width: 780px) {
  #botOptionsOverlay .modal.modal-wide {
    width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    padding: 16px;
  }

  #botOptionsOverlay .modal-option-list {
    grid-template-columns: 1fr;
  }
}

.modal-title {
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 8px 0;
  color: #262626;
}

.modal-text {
  font-size: 14px;
  color: #444;
  line-height: 1.35;
  margin: 0 0 14px 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 3px solid #262626;
  background: #FFFFFF;
  color: #262626;
  padding: 10px 14px;
  border-radius: 5px;
  font-size: 15px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .05s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  justify-content: center;
}

.btn:hover {
  background: #262626;
  color: #FFFFFF;
}

.btn.btn-danger,
button.btn-danger {
  background: #FFFFFF;
  color: var(--danger);
  border-color: var(--danger);
}

.btn.btn-danger:hover,
button.btn-danger:hover {
  background: var(--danger);
  color: #FFFFFF;
}

.modal .btn,
.modal button {
  margin: 0;
}

