﻿@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Sora:wght@300;400;500;600;700&display=swap");

:root {
  --bg: #f6f8fb;
  --bg-2: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --muted: #5b6475;
  --accent: #1a7f7a;
  --accent-2: #2563eb;
  --border: #e1e7ef;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sora", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fdfefe, var(--bg)) fixed,
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.ambient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 20% 15%, rgba(37, 99, 235, 0.14), transparent 45%),
    radial-gradient(circle at 80% 25%, rgba(26, 127, 122, 0.18), transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(37, 99, 235, 0.12), transparent 50%);
  pointer-events: none;
  animation: floatGlow 16s ease-in-out infinite;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px 16px;
  z-index: 1;
}

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

.account-pill {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.25);
}

.title {
  font-family: "Fraunces", serif;
  font-size: 28px;
  letter-spacing: 0.4px;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
}

.status {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  box-shadow: var(--shadow-soft);
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 0 32px 32px;
  z-index: 1;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}

.side .card:nth-child(1) {
  animation-delay: 0.05s;
}

.side .card:nth-child(2) {
  animation-delay: 0.1s;
}

.side .card:nth-child(3) {
  animation-delay: 0.15s;
}

.side .card:nth-child(4) {
  animation-delay: 0.2s;
}

.side .card:nth-child(5) {
  animation-delay: 0.25s;
}

.side .card:nth-child(6) {
  animation-delay: 0.3s;
}

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

.card h2 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
}

.chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(37, 99, 235, 0.1);
  color: #1e40af;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.chip.soft {
  background: rgba(26, 127, 122, 0.1);
  color: #0f766e;
  border-color: rgba(26, 127, 122, 0.2);
}

.switch {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch .track {
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: #dfe6f1;
  position: relative;
  transition: background 0.2s ease;
}

.switch .track::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 3px;
  left: 3px;
  box-shadow: 0 6px 10px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease;
}

.switch input:checked + .track {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.switch input:checked + .track::after {
  transform: translateX(22px);
}

.switch-label {
  font-size: 13px;
  color: var(--muted);
}

.switch input:checked ~ .switch-label {
  color: var(--ink);
  font-weight: 600;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: inherit;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.auth-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.auth-actions button {
  flex: 1;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.history-item:hover {
  border-color: rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.history-item.active {
  border-color: var(--accent-2);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.14);
}

.history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.history-time {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.history-empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
}

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

.docs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  max-height: 240px;
  overflow: auto;
}

.doc-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
}

.doc-item strong {
  display: block;
  font-weight: 600;
}

.notice p {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: var(--muted);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.messages {
  border: 1px solid rgba(225, 231, 239, 0.8);
  border-radius: 24px;
  padding: 20px;
  min-height: 55vh;
  max-height: 68vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}

.message {
  display: flex;
  margin-bottom: 14px;
}

.message.user {
  justify-content: flex-end;
}

.message .bubble {
  max-width: 74%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  line-height: 1.5;
  background: #fff;
}

.message.user .bubble {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  border-bottom-right-radius: 6px;
}

.message.assistant .bubble {
  border-bottom-left-radius: 6px;
}

.message .bubble img {
  width: 160px;
  border-radius: 12px;
  margin-bottom: 10px;
  display: block;
}

.msg-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.msg-meta button {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.composer textarea {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  min-height: 84px;
}

.composer textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left-actions,
.right-actions {
  display: flex;
  gap: 10px;
}

button {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  font-family: inherit;
  font-size: 13px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button.primary {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.2);
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.24);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.image-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.image-preview img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}

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

@keyframes floatGlow {
  0% {
    filter: blur(0px);
  }
  50% {
    filter: blur(2px);
  }
  100% {
    filter: blur(0px);
  }
}

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

  .messages {
    max-height: 52vh;
  }

  .message .bubble {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
