* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

header {
  background: #111827;
  color: white;
  padding: 18px 28px;
}

header h1 {
  margin: 0 0 6px 0;
  font-size: 24px;
}

header p {
  margin: 0;
  color: #d1d5db;
}

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  grid-template-rows: minmax(520px, 62vh) auto;
  gap: 16px;
  padding: 16px;
}

.panel {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.chat-panel {
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  min-height: 680px;
}

.map-panel {
  min-height: 520px;
}

.result-panel {
  grid-column: 2;
}

h2 {
  margin-top: 0;
  font-size: 18px;
}

h3 {
  font-size: 15px;
  margin-top: 18px;
}

#map {
  height: 455px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.selected-location {
  margin-top: 10px;
  font-size: 14px;
  color: #374151;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #f9fafb;
  margin-bottom: 12px;
}

.message {
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  line-height: 1.4;
  font-size: 14px;
}

.message.bot {
  background: #e8f0fe;
}

.message.user {
  background: #dcfce7;
  margin-left: 30px;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
}

.input-row {
  display: flex;
  gap: 8px;
}

#chatInput {
  flex: 1;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

button {
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

.hint {
  margin-top: 10px;
  color: #6b7280;
  font-size: 13px;
}

.result-summary {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 14px;
  border-radius: 12px;
  line-height: 1.5;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 9px;
  text-align: left;
}

th {
  background: #f3f4f6;
}

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

  .chat-panel,
  .result-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .chat-panel {
    min-height: 520px;
  }
}
