* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-alt: #f7f9fb;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f62fe;
  --accent-dark: #0043ce;
  --accent-soft: #eef4ff;
  --error: #b42318;
  --error-bg: #fef3f2;
  --error-border: #fecdca;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

html, body { height: 100%; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -10%, #e3ecff 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 860px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 8px 40px rgba(15, 23, 42, 0.08);
}

@media (min-width: 900px) {
  .app {
    height: calc(100vh - 40px);
    margin: 20px 0;
    border-radius: 16px;
    overflow: hidden;
  }
}

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.brand > div:last-child { min-width: 0; }

.header h1,
.subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right { flex-shrink: 0; }

.logo-dxc { flex-shrink: 0; }

.logo-dxc {
  height: 26px;
  width: auto;
  display: block;
}

.brand-divider {
  width: 1px;
  height: 30px;
  background: var(--border-strong);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-skf {
  height: 38px;
  width: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.header h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .subtitle { display: none; }
  .logo-dxc { height: 20px; }
  .brand-divider { height: 22px; }
  .header .btn-secondary { padding: 7px 10px; white-space: nowrap; }
  .header { gap: 10px; }
}

.subtitle {
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.15);
}

/* ---------- Warning banner ---------- */

.banner-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffaeb;
  border-bottom: 1px solid #fedf89;
  color: #93700c;
  padding: 10px 22px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.banner-warning svg { flex-shrink: 0; }
.banner-warning code {
  background: #fdf0d3;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ---------- Chat area ---------- */

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface-alt);
  scroll-behavior: smooth;
}

.chat::-webkit-scrollbar { width: 8px; }
.chat::-webkit-scrollbar-track { background: transparent; }
.chat::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

/* Welcome / empty state */

.welcome {
  margin: auto;
  text-align: center;
  max-width: 480px;
  padding: 30px 10px;
  animation: fadeUp 0.45s ease both;
}

.welcome-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.welcome p {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 24px;
}

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

.suggestion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px;
  font: inherit;
  font-size: 0.86rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.suggestion:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Messages */

.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeUp 0.3s ease both;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.assistant { align-self: flex-start; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.avatar-ai {
  background: linear-gradient(135deg, var(--accent) 0%, #4589ff 100%);
  color: #fff;
}

.avatar-user {
  background: #e2e8f0;
  color: #475569;
}

.bubble {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.user .bubble {
  background: linear-gradient(135deg, var(--accent) 0%, #2472ff 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(15, 98, 254, 0.25);
}

.message.assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.message.error .bubble {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
}

.bubble code {
  font-family: "Cascadia Code", Consolas, "SF Mono", monospace;
  background: rgba(15, 23, 42, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}
.message.user .bubble code { background: rgba(255, 255, 255, 0.22); }

.bubble pre {
  background: #0f172a;
  color: #e6edf3;
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 0.82rem;
  line-height: 1.55;
}
.bubble pre code { background: none; padding: 0; color: inherit; }

.bubble strong { font-weight: 600; }

/* Blinking cursor at the end of a streaming answer */
.bubble.streaming::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  border-radius: 2px;
  animation: blink 1s infinite;
}

/* ---------- Message actions (copy / regenerate / feedback) ---------- */

.message-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.message.user .message-body { align-items: flex-end; }

.msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.message:hover .msg-actions,
.msg-actions:focus-within {
  opacity: 1;
}

.action-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}

.action-btn:hover {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.action-btn.done { color: #12b76a; }

.action-fb.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Typing indicator ---------- */

.composer-area {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 22px 10px;
}

.typing {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 10px;
}
.typing.hidden { display: none; }

.typing-bubble {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
}

.typing-bubble span {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: blink 1.2s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

/* ---------- Composer ---------- */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.12);
  background: var(--surface);
}

#question {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  padding: 8px 0;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  max-height: 160px;
  outline: none;
  color: var(--text);
}

#question::placeholder { color: #94a3b8; }

.btn-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.btn-send:hover { background: var(--accent-dark); }
.btn-send:active { transform: scale(0.94); }
.btn-send:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
}

.composer-hint {
  text-align: center;
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 8px;
}

.btn-secondary {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- About modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fadeIn 0.2s ease both;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.25s ease both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.6;
}

.about-section { margin-bottom: 20px; }

.about-section h3 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}

.about-section p { color: var(--text); }

.about-section ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.tech-table tr { border-bottom: 1px solid var(--border); }
.tech-table tr:last-child { border-bottom: none; }

.tech-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px 8px 0;
  white-space: nowrap;
  vertical-align: top;
  width: 130px;
}

.tech-table td { padding: 8px 0; }

.tech-table code {
  font-family: "Cascadia Code", Consolas, "SF Mono", monospace;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82em;
}

.about-footer {
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 14px;
  text-align: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Animations ---------- */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .chat { scroll-behavior: auto; }
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  .header { padding: 12px 16px; }
  .chat { padding: 18px 14px; }
  .composer-area { padding: 10px 14px 8px; }
  .message { max-width: 94%; }
  .btn-secondary span { display: none; }
}
