:root {
  --bg-0: #f4f1e6;
  --bg-1: #fefcf6;
  --ink: #1f2d24;
  --ink-muted: #58675c;
  --panel: rgba(255, 252, 242, 0.86);
  --line: rgba(23, 48, 34, 0.14);
  --accent: #1e7a4a;
  --accent-strong: #115b35;
  --warn: #c05326;
  --shadow: 0 12px 30px rgba(18, 46, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', 'IBM Plex Sans', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #f7f4eb 0%, var(--bg-0) 40%, #ece7d6 100%);
  position: relative;
}

.bg {
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
  opacity: 0.5;
}

.bg-one {
  width: 38vw;
  height: 38vw;
  top: -8vw;
  right: -6vw;
  background: radial-gradient(circle, #4aa275 0%, transparent 70%);
}

.bg-two {
  width: 34vw;
  height: 34vw;
  bottom: -10vw;
  left: -8vw;
  background: radial-gradient(circle, #d48456 0%, transparent 70%);
}

.topbar,
.layout {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  letter-spacing: 0.01em;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
}

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

.topbar-actions {
  display: flex;
  gap: 8px;
}

.layout {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.2fr 1fr 1.1fr;
  padding: 0 24px 22px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.35s ease-out;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(250, 245, 233, 0.9));
}

.card-label {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.row.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.box.compact {
  margin-top: 10px;
}

.stack {
  display: grid;
  gap: 8px;
}

.profile-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-grid .full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(24, 52, 35, 0.2);
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.btn {
  border: 1px solid rgba(25, 70, 44, 0.28);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(12, 50, 29, 0.13);
}

.btn.accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ecfff3;
  border-color: transparent;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.4);
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.list {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.75);
}

.list-item .small {
  color: var(--ink-muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.chat-session-tools {
  display: flex;
  gap: 8px;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  min-height: 360px;
  max-height: 420px;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.chat-msg {
  border-radius: 12px;
  padding: 9px 10px;
  white-space: pre-wrap;
  border: 1px solid rgba(26, 63, 41, 0.14);
}

.chat-msg.user {
  background: rgba(22, 117, 65, 0.11);
}

.chat-msg.assistant {
  background: rgba(255, 255, 255, 0.88);
}

.chat-meta {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.chat-form {
  margin-top: 10px;
}

.chat-controls {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-buttons {
  display: flex;
  gap: 8px;
}

.status-line {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  background: rgba(30, 122, 74, 0.15);
  color: var(--accent-strong);
}

.warn {
  color: var(--warn);
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }
  .chat-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 840px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .layout {
    grid-template-columns: 1fr;
    padding: 0 12px 14px;
  }
  .row.two,
  .profile-grid,
  .cards {
    grid-template-columns: 1fr;
  }
  .chat-controls {
    flex-direction: column;
    align-items: stretch;
  }
}
