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

:root {
  /* ===== Bachman-inspired palette (estimated) =====
     Warm flannel rose + slate/denim navy + warm cream neutrals
  */
  --bg: #f6f1ee; /* warm cream */
  --bg-strong: #efe6e2; /* slightly stronger cream */
  --panel: #ffffff;
  --panel-soft: #fbf7f6; /* soft warm near-white */
  --border: #e6dcda;

  --text: #2e2e2e; /* charcoal ink */
  --muted: #6e6664;

  /* Primary accent = warm flannel rose */
  --accent: #c9898e;
  --accent-dark: #8b565b;
  --accent-soft: #f2d7da;

  /* Keep the variable name `--teal` for compatibility,
     but shift it to slate/denim blue used across the UI. */
  --teal: #4a5f73;

  --shadow: 0 24px 60px rgba(47, 64, 82, 0.14);

  /* Optional extra blues for gradients */
  --blue: #4a5f73;
  --blue-dark: #2f4052;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at top, #fbf3f4, var(--bg));
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: "Fraunces", "Times New Roman", serif;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
  line-height: 1.6;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(0px);
  opacity: 0.55;
  animation: float 14s ease-in-out infinite;
}

/* Re-colored orbs to match rose + slate palette */
.orb--a {
  width: 340px;
  height: 340px;
  background: radial-gradient(
    circle,
    rgba(201, 137, 142, 0.55),
    transparent 70%
  );
  top: -90px;
  left: -80px;
}

.orb--b {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(74, 95, 115, 0.45), transparent 70%);
  bottom: -120px;
  right: -140px;
  animation-delay: 1.5s;
}

.orb--c {
  width: 280px;
  height: 280px;
  background: radial-gradient(
    circle,
    rgba(226, 177, 182, 0.45),
    transparent 70%
  );
  top: 30%;
  right: 15%;
  animation-delay: 3s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(18px);
  }
}

.app-header {
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--accent), rgba(226, 177, 182, 1));
  color: white;
  font-family: "Fraunces", serif;
  font-size: 1.4rem;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 24px rgba(201, 137, 142, 0.28);
}

.subtitle {
  color: var(--muted);
  margin-top: 0.25rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.subtle {
  background: var(--bg-strong);
  color: var(--muted);
}

.brand-logo {
  width: 48px;
  height: 48px;
  margin-right: 12px;
  border-radius: 12px;
}

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

.brand-hero-image {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 10px 26px rgba(47, 64, 82, 0.18);
}

.brand-text h1 {
  margin: 0;
}

@media (max-width: 640px) {
  .brand-hero-image {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.ghost-button:hover {
  border-color: rgba(74, 95, 115, 0.35);
  background: rgba(74, 95, 115, 0.06);
}

.notice {
  background: var(--panel-soft);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.notice-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem 2rem 2rem;
}

.chat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  min-height: 72vh;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(120deg, rgba(242, 215, 218, 0.35), #ffffff 55%);
}

.chat-header h2 {
  font-size: 1.4rem;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--teal);
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(74, 95, 115, 0.5);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 95, 115, 0.55);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(74, 95, 115, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 95, 115, 0);
  }
}

.chat-log {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 1)
  );
}

.message {
  max-width: 78%;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid transparent;
  animation: fadeUp 0.35s ease;
}

.message p {
  margin-top: 0.35rem;
}

.message-meta {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.message.system {
  border-color: rgba(230, 220, 218, 1);
}

.message.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: rgba(201, 137, 142, 0.55);
  color: rgba(47, 24, 27, 1);
}

.message.typing {
  font-style: italic;
  color: var(--muted);
  background: rgba(246, 241, 238, 1);
}

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

.chat-form {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
}

.chat-form textarea {
  flex: 1;
  resize: none;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  background: white;
}

.chat-form textarea:focus {
  outline: 2px solid rgba(201, 137, 142, 0.28);
  border-color: var(--accent);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), rgba(226, 177, 182, 1));
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 12px 28px rgba(201, 137, 142, 0.28);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.button-icon {
  font-size: 1.1rem;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0 1.5rem 1.5rem;
  border-top: 1px dashed var(--border);
  background: rgba(246, 241, 238, 0.75);
}

.chip {
  background: white;
  border: 1px solid var(--border);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.tools {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.tool-group {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1.2rem;
  border-radius: 20px;
  box-shadow: 0 18px 32px rgba(47, 64, 82, 0.09);
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tool-group h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.tool-group button {
  display: block;
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.tool-group button:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(74, 95, 115, 0.06);
}

.tool-group button.secondary {
  background: var(--accent-soft);
  border-color: rgba(201, 137, 142, 0.55);
}

.tool-group textarea {
  width: 100%;
  resize: vertical;
  padding: 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-family: inherit;
}

.checklist {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.7;
}

.app-footer {
  padding: 1.5rem 2rem 2.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

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

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

  .chat {
    min-height: 60vh;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-form {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button {
    width: 100%;
    justify-content: center;
  }
}
