* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fb;
  color: #1f2933;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

header {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25);
}

header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

header .session {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

header code {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

header button {
  padding: 0.4rem 0.8rem;
  border: 0;
  border-radius: 6px;
  background: #ffffff;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
}

main {
  flex: 1;
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem;
  grid-template-columns: 2fr 1fr;
}

.chat-panel,
.info-panel .card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header,
.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.chat-log {
  padding: 1.25rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: repeating-linear-gradient(135deg, #f8fafc, #f8fafc 12px, #f1f5f9 12px, #f1f5f9 24px);
}

.message {
  background: #fff;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.message.user {
  border-left: 4px solid #2563eb;
}

.message.assistant {
  border-left: 4px solid #7c3aed;
}

.message .meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.message .content {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

#chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

#chat-input {
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  padding: 0.75rem;
  resize: vertical;
  min-height: 3rem;
  font-size: 1rem;
  box-shadow: inset 0 3px 8px rgba(148, 163, 184, 0.2);
}

#chat-form button,
.card button,
button[type="submit"] {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.25);
}

.card {
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
}

.task-item {
  background: #f8faff;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.task-item header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.task-item .badge {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.task-item footer {
  font-size: 0.8rem;
  color: #475569;
}

details {
  margin: 0 1.25rem 0.5rem;
  background: #f9fafb;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  border: 1px solid #e2e8f0;
}

details[open] {
  background: #ffffff;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.field input,
.field select {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
}

dt {
  font-weight: 600;
  color: #334155;
}

dd {
  margin: 0 0 0.6rem;
  color: #475569;
}

@media (max-width: 1024px) {
  main {
    grid-template-columns: 1fr;
  }

  .info-panel {
    display: grid;
    gap: 1.25rem;
  }
}

@media (max-width: 640px) {
  header {
    padding: 1.25rem;
  }

  main {
    padding: 1rem;
  }

  #chat-form button,
  .card button,
  button[type="submit"] {
    width: 100%;
  }
}
