@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #121824;
  --panel-strong: #0f141e;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e5edf5;
  --muted: #9fb0c5;
  --accent: #39d6b4;
  --accent-2: #f9b95b;
  --danger: #ff6b6b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at top left, #1b2433 0%, #0b0f14 55%), #0b0f14;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.4;
  z-index: -1;
}

.orb-1 {
  width: 360px;
  height: 360px;
  background: #39d6b4;
  top: -120px;
  left: -120px;
}

.orb-2 {
  width: 420px;
  height: 420px;
  background: #f9b95b;
  bottom: -160px;
  right: -120px;
}

.app {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  padding: 28px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(140deg, #39d6b4, #0f6f8c);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

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

input {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-family: "Space Grotesk", sans-serif;
}

input:focus {
  outline: 2px solid rgba(57, 214, 180, 0.4);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

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

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: linear-gradient(140deg, #39d6b4, #0f6f8c);
  color: #041417;
  box-shadow: 0 10px 20px rgba(57, 214, 180, 0.3);
}

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

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

.status {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

.email-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}

.email-item {
  background: var(--panel-strong);
  border: 1px solid transparent;
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  transition: border 0.2s ease, transform 0.2s ease;
}

.email-item:hover {
  border-color: rgba(57, 214, 180, 0.4);
  transform: translateY(-2px);
}

.email-subject {
  font-weight: 600;
  font-size: 14px;
}

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

.email-date {
  font-size: 11px;
  color: var(--accent-2);
}

.main {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 20px;
}

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

.summary-output {
  margin-top: 16px;
  line-height: 1.6;
}

.summary-output.empty,
.pill-list.empty {
  color: var(--muted);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.pill {
  background: rgba(57, 214, 180, 0.15);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
  overflow-y: auto;
}

.chat-bubble {
  max-width: 70%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(57, 214, 180, 0.2);
}

.chat-bubble.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
}

.chat-input {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.chat-input input {
  flex: 1;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--panel);
  border-radius: 20px;
  padding: 22px;
  width: min(860px, 96vw);
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-body {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: var(--muted);
}

.modal-close {
  float: right;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.loader {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}

.loader.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(57, 214, 180, 0.2);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.loader-text {
  color: var(--muted);
  font-size: 14px;
}

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

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

  .main {
    grid-template-rows: auto auto auto;
  }
}
