:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-strong: #f0f7f4;
  --text: #18211f;
  --muted: #66706c;
  --border: #d8ddd7;
  --primary: #176b5b;
  --primary-dark: #0e493f;
  --accent: #b84a35;
  --pending: #8a5a00;
  --completed: #1f7a4f;
  --cancelled: #a23a3a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: linear-gradient(135deg, #f7f5ef 0%, #e9f1ee 55%, #f4eee7 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: start;
}

.composer-panel,
.agenda-panel,
.history-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 60px rgba(28, 43, 39, 0.1);
}

.composer-panel {
  padding: 28px;
}

.agenda-panel,
.history-panel {
  padding: 24px;
}

.history-panel {
  grid-column: 1 / -1;
}

.brand-row,
.agenda-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 7vw, 4.75rem);
  line-height: 0.95;
  max-width: 760px;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid #c9ded8;
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--primary-dark);
  background: var(--surface-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.runtime-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.runtime-panel div {
  border: 1px solid #d9e5df;
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfa;
}

.runtime-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.runtime-panel strong {
  display: block;
  margin-top: 6px;
  color: var(--primary-dark);
  font-size: 0.98rem;
}

.runtime-panel strong[data-mode="openai"],
.runtime-panel strong[data-configured="true"] {
  color: var(--completed);
}

.runtime-panel strong[data-mode="rules"],
.runtime-panel strong[data-configured="false"] {
  color: var(--pending);
}

.message-form {
  margin-top: 34px;
}

.message-form label {
  display: block;
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.message-form > input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--text);
  background: #ffffff;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
}

.input-row input {
  min-width: 0;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--text);
  background: #ffffff;
}

.input-row button,
.agenda-header button {
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.quick-actions button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--primary-dark);
  background: #e4f1ed;
  font-size: 0.9rem;
  font-weight: 800;
}

.quick-actions button:hover {
  background: #d2e8e1;
}

.clarification-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid #e6cf90;
  border-radius: 8px;
  padding: 14px;
  background: #fff8e8;
}

.clarification-panel[hidden] {
  display: none;
}

.clarification-panel span {
  display: block;
  color: var(--pending);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.clarification-panel strong {
  display: block;
  margin-top: 4px;
}

.clarification-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.clarification-actions button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--pending);
  background: #ffeab5;
  font-size: 0.86rem;
  font-weight: 800;
}

.clarification-actions button:hover {
  background: #f8dda2;
}

.response-panel {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.reply-text {
  margin: 10px 0 14px;
  color: var(--primary-dark);
  font-weight: 800;
}

pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border: 1px solid #d9e1dd;
  border-radius: 6px;
  padding: 16px;
  color: #20312d;
  background: #f8fbfa;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.agenda-grid {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.list-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.item-list {
  display: grid;
  gap: 10px;
  min-height: 72px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.agenda-item {
  border: 1px solid #dfe5e1;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.agenda-item.missing-schedule {
  border-color: #ead8a9;
  background: #fffaf0;
}

.agenda-item strong {
  display: block;
  font-size: 0.98rem;
}

.agenda-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.status {
  display: inline-flex;
  width: fit-content;
  margin-top: 9px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.status.pending {
  color: var(--pending);
  background: #fff3d5;
}

.status.completed {
  color: var(--completed);
  background: #dff4e8;
}

.status.cancelled {
  color: var(--cancelled);
  background: #f8dddd;
}

.quality,
.badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 800;
}

.quality.ok,
.badge.ok {
  color: var(--completed);
  background: #dff4e8;
}

.quality.warning,
.badge.warning {
  color: var(--pending);
  background: #fff3d5;
}

.badge.neutral {
  color: var(--primary-dark);
  background: #e4f1ed;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.history-item {
  border: 1px solid #dfe5e1;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.history-item strong {
  display: block;
  line-height: 1.35;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.history-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.history-reply {
  display: block;
  margin-top: 8px;
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 800;
}

.empty-state {
  border: 1px dashed #cfd7d2;
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
}

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

  .history-list {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 3rem;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .composer-panel,
  .agenda-panel {
    padding: 18px;
  }

  .brand-row,
  .agenda-header {
    display: grid;
  }

  .runtime-panel {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .input-row button {
    min-height: 46px;
  }
}
