:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66737c;
  --line: #dce3e7;
  --accent: #167d73;
  --accent-dark: #0e5f58;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
  min-height: 100vh;
  padding: 28px 22px;
  background: #101b1f;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

.eyebrow {
  color: #699892;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

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

h1 {
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 17px;
  margin-bottom: 16px;
}

nav {
  display: grid;
  gap: 8px;
}

button,
select,
input,
textarea {
  font: inherit;
}

.tab,
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
}

.tab {
  text-align: left;
  color: white;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
}

.tab.active {
  background: #1f3438;
  border-color: #4d7772;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 700;
}

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

.sidebar-note {
  margin-top: auto;
  color: #aab9bb;
  line-height: 1.6;
  font-size: 13px;
}

main {
  padding: 28px;
  min-width: 0;
}

.panel {
  display: none;
}

.panel.active {
  display: grid;
  gap: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.compact-head {
  margin-bottom: 12px;
}

.compact-head h3 {
  margin-bottom: 4px;
}

.grid {
  display: grid;
  gap: 18px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact {
  gap: 12px;
}

.block,
.table-wrap,
.preview,
.task {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #36434a;
  font-size: 14px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 125, 115, 0.12);
}

.inline {
  display: flex;
  align-items: center;
  gap: 9px;
}

.inline input {
  width: 18px;
  height: 18px;
}

.hint,
.result {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.quick-start {
  border-color: #b8d8d2;
  background: #fbfefe;
}

.callback-config {
  border-color: #c8d9e8;
  background: #fbfdff;
}

.config-values {
  display: grid;
  gap: 12px;
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-field input {
  background: white;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.quick-actions {
  flex-wrap: wrap;
}

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

.flow-steps span {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f1f7f5;
  color: #31534f;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.task-list {
  display: grid;
  gap: 12px;
}

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

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.task p {
  margin: 0;
  line-height: 1.55;
}

.chat-workbench {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
}

.chat-window {
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.chat-bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.55;
}

.chat-bubble p {
  margin: 0;
}

.chat-bubble span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.chat-bubble.customer {
  justify-self: end;
  background: #dff3ed;
}

.chat-bubble.robot {
  justify-self: start;
  background: white;
  border: 1px solid var(--line);
}

.chat-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) auto;
  align-items: end;
}

.stats .block {
  display: grid;
  gap: 4px;
}

.stats span {
  font-size: 30px;
  font-weight: 800;
}

.stats small {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #e8f4f1;
  color: #0e5f58;
  font-weight: 700;
}

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #172026;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    min-height: auto;
    position: static;
  }

  .two,
  .three {
    grid-template-columns: 1fr;
  }

  .section-head,
  .actions,
  .chat-form {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .flow-steps {
    grid-template-columns: 1fr;
  }
}
