:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --panel: #fffdf8;
  --ink: #25221d;
  --muted: #706b62;
  --line: #ded8cc;
  --accent: #1f7a6d;
  --accent-strong: #155a51;
  --coral: #b24a3b;
  --soft-green: #e6f1ec;
  --soft-coral: #f7e8e3;
  --shadow: 0 18px 50px rgba(40, 34, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  width: min(1280px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin: 16px auto;
}

.chat-panel,
.order-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.topbar,
.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.top-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.reset-button,
.log-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.reset-button:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.log-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.log-button.active {
  border-color: var(--accent);
  background: var(--soft-green);
  color: var(--accent-strong);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 14px;
}

.status-pill {
  min-width: 132px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--soft-green);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.status-pill.agent {
  background: #eef0f6;
  color: #3d4d78;
}

.status-pill.agent.live {
  background: var(--soft-coral);
  color: var(--coral);
}

.scenario-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.scenario-bar button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.scenario-bar button:hover {
  border-color: var(--accent);
}

.messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 20px;
}

.message {
  width: min(680px, 88%);
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message.assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #ffffff;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.composer input {
  min-width: 0;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
}

.composer button,
.confirmation-box button {
  min-height: 42px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.composer button {
  padding: 0 18px;
}

.composer button:hover,
.confirmation-box button:hover {
  background: var(--accent-strong);
}

.composer button:disabled,
.confirmation-box button:disabled,
.reset-button:disabled,
.log-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.order-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.order-header strong {
  color: var(--coral);
  font-size: 22px;
}

.order-list {
  min-height: 160px;
  overflow: auto;
  padding: 16px 18px;
}

.empty-order {
  color: var(--muted);
  line-height: 1.4;
}

.order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.order-item span {
  color: var(--muted);
  font-size: 13px;
}

.confirmation-box {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 18px 16px;
  padding: 12px;
  border: 1px solid #efc7bc;
  border-radius: 8px;
  background: var(--soft-coral);
}

.confirmation-box.visible {
  display: flex;
}

.confirmation-box span {
  color: var(--coral);
  font-size: 13px;
  font-weight: 700;
}

.confirmation-box button {
  padding: 0 12px;
}

.data-card {
  margin: 0 18px 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.data-card h3 {
  margin-bottom: 8px;
}

pre {
  max-height: 150px;
  margin: 0;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 20px);
    width: min(100vw - 20px, 680px);
    margin: 10px auto;
  }

  .chat-panel {
    min-height: 68vh;
  }

  .order-panel {
    min-height: 360px;
  }

  .message {
    width: 94%;
  }
}

@media (max-width: 540px) {
  .topbar,
  .order-header,
  .composer {
    padding-inline: 14px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .scenario-bar {
    padding-inline: 14px;
  }

  .scenario-bar button {
    flex: 1 1 150px;
  }
}
