﻿:root {
  --green: #e62814;
  --green-dark: #b91f10;
  --green-soft: #fff1ef;
  --gray: #777777;
  --gray-line: #dedede;
  --gray-soft: #f7f7f7;
  --text: #050505;
  --muted: #5f5f5f;
  --pink: #e62814;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.layout-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  background: #ffffff;
}

.sidebar {
  height: 100vh;
  border-right: 1px solid var(--gray-line);
  padding: 28px 0 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 18px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.brand-title {
  color: var(--green);
  font-size: 17px;
  font-weight: 700;
}

.new-faq-btn {
  margin: 0 12px 20px;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--gray-line);
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  cursor: pointer;
}

.new-faq-btn:hover,
.ghost-pill:hover,
.recent-menu:hover,
.modal-close:hover {
  background: var(--gray-soft);
}

.new-faq-icon {
  color: var(--green);
  font-weight: 700;
}

.sidebar-section {
  border-top: 1px solid var(--gray-line);
  padding: 14px 12px 0;
  overflow: auto;
}

.sidebar-section h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.recent-list {
  display: grid;
  gap: 8px;
  padding-bottom: 20px;
}

.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: start;
}

.recent-item,
.recent-menu {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.recent-item {
  padding: 8px 10px;
  border-radius: 12px;
  text-align: left;
  color: var(--text);
  line-height: 1.45;
}

.recent-item.is-active,
.recent-item:hover {
  background: var(--gray-soft);
}

.recent-menu {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  line-height: 1;
  display: grid;
  place-items: center;
}

.trash-icon {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  transition: transform 0.16s ease, stroke 0.16s ease, opacity 0.16s ease;
}

.recent-menu:hover {
  color: var(--pink);
}

.recent-menu:hover .trash-icon {
  opacity: 1;
  transform: scale(1.12);
}

.main-stage {
  height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 18px;
  padding: 22px 28px 24px;
  min-width: 0;
}

.conversation-viewport {
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}

.hero-empty {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
}

.hero-empty h1 {
  max-width: 700px;
  margin: 0;
  text-align: center;
  font-size: 30px;
  line-height: 1.35;
  font-weight: 700;
}

.conversation-list {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  gap: 18px;
  padding: 6px 0 8px;
}

.chat-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  position: sticky;
  top: 0;
}

.chat-row.assistant .chat-avatar {
  background: rgba(230, 40, 20, 0.15);
  color: var(--green-dark);
}

.chat-row.user .chat-avatar {
  background: #f0f0ef;
  color: #555;
}

.chat-bubble {
  border: 1px solid var(--gray-line);
  border-radius: 22px;
  background: #fff;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.chat-label,
.assistant-faq-index,
.modal-kicker {
  margin: 0 0 8px;
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-text {
  margin: 0;
  line-height: 1.75;
  font-size: 17px;
}

.loading-bubble {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(230, 40, 20, 0.2);
  border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.assistant-faq-wrap {
  display: grid;
  gap: 10px;
}

.faq-card-wrap {
  display: grid;
  gap: 8px;
}

.faq-bubble {
  border-radius: 18px;
  background: var(--green-soft);
  border: 1px solid rgba(230, 40, 20, 0.2);
  padding: 18px 18px 14px;
}

.faq-bubble.is-editing {
  border-color: rgba(230, 40, 20, 0.45);
  box-shadow: inset 0 0 0 1px rgba(230, 40, 20, 0.18);
}

.faq-bubble-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.faq-bubble-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

.faq-bubble-title[contenteditable="true"],
.faq-bubble-body[contenteditable="true"] {
  outline: none;
}

.faq-bubble-title[contenteditable="true"] {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  padding: 2px 4px;
}

.faq-bubble-body {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.faq-editor-toolbar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(230, 40, 20, 0.16);
}

.faq-toolbar-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(146, 146, 145, 0.25);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.faq-toolbar-btn:hover {
  border-color: rgba(230, 40, 20, 0.35);
  background: rgba(255, 255, 255, 0.95);
  color: var(--green-dark);
}

.faq-toolbar-btn strong,
.faq-toolbar-btn em,
.faq-toolbar-underlined {
  font-size: 14px;
  line-height: 1;
}

.faq-toolbar-underlined {
  text-decoration: underline;
}

.faq-bubble-body p {
  margin: 0;
  font-size: 17px;
  line-height: 1.8;
}

.faq-bubble-body h4 {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
  font-weight: 700;
}

.faq-bubble-body ul {
  margin: -2px 0 0;
  padding-left: 20px;
  list-style: disc;
  display: grid;
  gap: 8px;
}

.faq-bubble-body li {
  font-size: 17px;
  line-height: 1.75;
  list-style: disc;
}

.faq-bubble-body li::marker {
  color: #171814;
}

.faq-bubble-body.is-editing {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.48);
  padding: 8px 10px;
}

.faq-image-list {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: 12px;
}

.faq-image-card {
  border: 1px solid rgba(230, 40, 20, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

.faq-image-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  background: #fff;
  cursor: zoom-in;
}

.faq-image-card img.is-pending {
  min-height: 160px;
  background:
    linear-gradient(90deg, rgba(230, 40, 20, 0.08), rgba(230, 40, 20, 0.18), rgba(230, 40, 20, 0.08));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

.faq-image-caption {
  margin: 0;
  padding: 9px 10px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.faq-bubble-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(230, 40, 20, 0.18);
  display: grid;
  gap: 10px;
}

.faq-feedback {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(230, 40, 20, 0.18);
  display: grid;
  gap: 12px;
}

.faq-feedback-title,
.faq-feedback-thanks,
.faq-feedback-label {
  margin: 0;
}

.faq-feedback-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.faq-feedback-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.faq-feedback-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(230, 40, 20, 0.32);
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.faq-feedback-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(230, 40, 20, 0.46);
}

.faq-feedback-btn.is-selected,
.faq-feedback-btn:disabled {
  background: rgba(230, 40, 20, 0.12);
  color: var(--green-dark);
  cursor: default;
}

.faq-feedback-icon {
  font-size: 14px;
  line-height: 1;
}

.faq-feedback-thanks {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.faq-feedback-comment {
  display: grid;
  gap: 10px;
}

.faq-feedback-label {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
}

.faq-feedback-comment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: end;
}

.faq-feedback-textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(230, 40, 20, 0.4);
  background: #fff;
  color: var(--text);
  line-height: 1.6;
  outline: none;
}

.faq-feedback-textarea:focus {
  border-color: rgba(230, 40, 20, 0.6);
  box-shadow: 0 0 0 4px rgba(230, 40, 20, 0.12);
}

.faq-feedback-submit {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #c8cbc4;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.faq-feedback-submit.is-ready {
  background: var(--green);
}

.faq-feedback-submit:not(:disabled):hover {
  background: var(--green);
  transform: translateY(-1px);
}

.faq-feedback-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.faq-source-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.faq-source-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.source-mini-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(230, 40, 20, 0.18);
  background: rgba(255, 255, 255, 0.8);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.faq-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.faq-disclaimer {
  margin: 2px 16px 0 0;
  max-width: 720px;
  color: #7e827b;
  font-size: 12px;
  line-height: 1.45;
}

.faq-actions-buttons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.faq-edit-btn,
.faq-copy-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(146, 146, 145, 0.25);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.faq-edit-btn:hover,
.faq-copy-btn:hover {
  color: var(--green-dark);
  border-color: rgba(230, 40, 20, 0.35);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

.faq-edit-btn::after,
.faq-copy-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(31, 32, 28, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.faq-edit-btn:hover::after,
.faq-copy-btn:hover::after,
.faq-edit-btn.is-editing::after,
.faq-copy-btn.is-copied::after {
  opacity: 1;
  transform: translateY(0);
}

.faq-edit-icon,
.faq-copy-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
}

.faq-edit-btn.is-editing {
  color: var(--green-dark);
  border-color: rgba(230, 40, 20, 0.45);
  background: rgba(230, 40, 20, 0.12);
}

.composer-dock {
  width: min(100%, 980px);
  margin: 0 auto;
}

.composer-card {
  border: 1px solid var(--gray-line);
  border-radius: 22px;
  background: #fff;
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  background: rgba(230, 40, 20, 0.14);
  color: var(--green-dark);
  border: 1px solid rgba(230, 40, 20, 0.2);
  font-size: 13px;
  font-weight: 700;
}

.active-filter-remove {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--green-dark);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  transition: color 0.16s ease, background 0.16s ease;
}

.active-filter-remove:hover {
  color: var(--pink);
  background: rgba(230, 40, 20, 0.08);
}

.composer-card.is-dragover {
  border-color: rgba(230, 40, 20, 0.5);
  box-shadow: 0 0 0 4px rgba(230, 40, 20, 0.12);
}

.composer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-pill {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #cfd1cb;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.selected-file-wrap {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  padding-right: 34px;
  border-radius: 12px;
  background: var(--gray-soft);
  color: var(--muted);
  position: relative;
}

.selected-file-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.selected-file-remove:hover {
  color: var(--pink);
  background: #fff1ef;
}

.selected-file-label {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(230, 40, 20, 0.12);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

#questionInput {
  width: 100%;
  margin-top: 14px;
  border: 0;
  outline: none;
  resize: none;
  min-height: 180px;
  padding: 14px 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  background: transparent;
}

.composer-card.is-compact #questionInput {
  min-height: 34px;
  height: 34px;
  padding-top: 2px;
}

.composer-card.is-compact {
  padding-top: 10px;
  padding-bottom: 8px;
}

#questionInput::placeholder {
  color: var(--muted);
}

.composer-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.send-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.error-box {
  width: min(100%, 980px);
  margin: 0 auto;
  border: 1px solid rgba(230, 40, 20, 0.18);
  border-radius: 14px;
  background: #fff7fb;
  color: #a11758;
  padding: 12px 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 16, 0.24);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-card {
  width: min(100%, 460px);
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--gray-line);
  box-shadow: 0 24px 60px rgba(18, 24, 11, 0.16);
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--gray-line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--pink);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 18, 12, 0.86);
  display: grid;
  place-items: center;
  padding: 32px;
}

.image-lightbox-figure {
  margin: 0;
  max-width: min(92vw, 1200px);
  max-height: calc(100vh - 96px);
  display: grid;
  gap: 12px;
}

.image-lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.image-lightbox-caption {
  margin: 0;
  color: #fff;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

.image-lightbox-close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.image-lightbox-close:hover {
  color: var(--pink);
  background: rgba(255, 255, 255, 0.14);
}

.modal-grid {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.option-field {
  display: grid;
  gap: 7px;
}

.option-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.option-field select {
  width: 100%;
  border: 1px solid var(--gray-line);
  border-radius: 12px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
}

.option-field select:focus {
  outline: none;
  border-color: rgba(230, 40, 20, 0.55);
  box-shadow: 0 0 0 4px rgba(230, 40, 20, 0.12);
}

.modal-footer {
  margin-top: 18px;
  display: flex;
  justify-content: end;
}

.apply-btn {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: #fff1ef;
  color: var(--green-dark);
  cursor: pointer;
  font-weight: 700;
}

.hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 920px) {
  html,
  body {
    overflow: auto;
  }

  .layout-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar,
  .main-stage {
    height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--gray-line);
  }

  .conversation-viewport {
    overflow: visible;
  }
}

@media (max-width: 700px) {
  .main-stage {
    padding: 18px 14px 18px;
  }

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

  .chat-avatar {
    position: static;
  }

  .faq-bubble-head,
  .composer-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .faq-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .faq-actions-buttons {
    align-self: flex-end;
  }

  .hero-empty h1 {
    font-size: 24px;
  }

  .faq-bubble-title {
    font-size: 20px;
  }
}
