:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #151922;
  --muted: #667085;
  --line: #d9e0ea;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b45309;
  --rose: #be123c;
  --soft-teal: #e6f4f1;
  --soft-blue: #eaf0ff;
  --soft-amber: #fff4df;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.08);
}

* {
  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,
textarea,
input {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  padding: 24px 18px;
  background: #101828;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #101828;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav a {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 650;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.shell {
  min-width: 0;
  margin-left: 232px;
  padding: 28px;
}

.topbar,
.section-header,
.section-actions,
.actions,
.conversation-main,
.conversation-meta,
.order,
.order-status,
.cell-person,
.stage-contact {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 14px;
}

.actions {
  gap: 10px;
}

.section-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
}

.button.primary {
  background: var(--teal);
  color: #ffffff;
}

.button.secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.button.danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: var(--rose);
}

.button.compact {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.section,
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.metric strong {
  font-size: 28px;
}

.metric.accent {
  background: var(--soft-amber);
}

.section {
  padding: 18px;
  margin-bottom: 18px;
}

.section-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.stage {
  min-height: 210px;
  padding: 12px;
  box-shadow: none;
}

.stage header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stage header span {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-weight: 800;
}

.stage-list {
  display: grid;
  gap: 10px;
}

.stage-contact {
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcff;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft-teal);
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
}

small,
.empty {
  color: var(--muted);
  font-size: 12px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
}

.conversation-list,
.order-list,
.bot-rules {
  display: grid;
  gap: 10px;
}

.status-panel {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-panel.ok {
  border-color: #9bd8c9;
  background: var(--soft-teal);
  color: var(--teal);
}

.status-panel.warning {
  border-color: #f1c27a;
  background: var(--soft-amber);
  color: var(--amber);
}

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

.conversation-main {
  min-width: 0;
  gap: 10px;
}

.conversation-main p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta {
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.conversation-meta span,
.pill {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: #1d4ed8;
  font-weight: 750;
}

.order {
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.order:last-child {
  border-bottom: 0;
}

.order p {
  margin: 4px 0 0;
  color: var(--muted);
}

.order-status {
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.order-status span {
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

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

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

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

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

.cell-person {
  gap: 10px;
}

.cell-person strong,
.stage-contact strong {
  display: block;
}

.bot-rule {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.bot-rule span {
  color: var(--rose);
  font-size: 12px;
  font-weight: 850;
}

.bot-rule p {
  margin: 6px 0 0;
  color: var(--muted);
}

.demo-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.demo-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #101828;
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.login-panel {
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.25);
}

.login-brand {
  color: var(--ink);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--rose);
  font-size: 13px;
  font-weight: 750;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 14px;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    margin-top: 14px;
  }

  .shell {
    margin-left: 0;
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .conversation-meta {
    justify-content: flex-start;
  }
}
