@font-face {
  font-family: Space Grotesk;
  src: url("/static/fonts/space-grotesk-semibold.ttf") format("truetype");
  font-weight: 600 700;
  font-display: swap;
}
:root {
  --ink: #0f172a;
  --paper: #f3f6fa;
  --surface: #fff;
  --soft: #f0f4f9;
  --line: #d8e1ec;
  --muted: #526174;
  --brand: #245bcc;
  --brand2: #4279d7;
  --accent: #e5efff;
  --green: #047857;
  --red: #b4233b;
  --shadow: 0 16px 38px rgba(15, 35, 65, 0.06);
  font:
    14px Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #edf4ff;
  --paper: #08111f;
  --surface: #101b2d;
  --soft: #162338;
  --line: #2a3b52;
  --muted: #b1bfd1;
  --brand: #93c5fd;
  --brand2: #4279d7;
  --accent: #162d4e;
  --green: #6ee7b7;
  --red: #fda4af;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(
      900px 580px at 100% -10%,
      color-mix(in srgb, var(--brand) 12%, transparent),
      transparent 65%
    ),
    var(--paper);
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  border: 0;
  cursor: pointer;
  color: inherit;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
}
textarea {
  min-height: 106px;
  resize: vertical;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2 {
  font-family:
    Space Grotesk,
    sans-serif;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 25px;
}
h3 {
  font-size: 14px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff;
  font: 700 23px Space Grotesk;
}
.eyebrow,
.crumb {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.btn {
  min-height: 42px;
  border-radius: 10px;
  padding: 0 15px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition:
    transform 0.18s,
    background 0.18s;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn.primary {
  background: var(--brand);
  color: #fff;
}
.btn.secondary {
  background: var(--soft);
  border: 1px solid var(--line);
}
.btn.danger {
  background: var(--red);
  color: #fff;
}
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
  padding: 8px 0;
}
.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--soft);
  display: grid;
  place-items: center;
}
.status {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}
.status.ok {
  background: color-mix(in srgb, var(--green) 15%, transparent);
  color: var(--green);
}
.status.muted {
  background: var(--soft);
  color: var(--muted);
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 28px;
  padding: 24px;
}
.auth-brand,
.platform-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.auth-brand b,
.platform-brand b {
  letter-spacing: 1.2px;
  font-size: 17px;
}
.auth-brand small,
.platform-brand small {
  display: block;
  letter-spacing: 1.4px;
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}
.auth-card {
  width: min(100%, 430px);
  padding: 34px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.auth-card h1 {
  font-size: 29px;
  margin: 8px 0;
}
.auth-card > p {
  color: var(--muted);
  line-height: 1.55;
}
.form-stack {
  display: grid;
  gap: 16px;
  margin-top: 25px;
}
.form-stack label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
}
.form-stack label small {
  font-weight: 400;
  color: var(--muted);
}
.form-error {
  color: var(--red) !important;
  min-height: 18px;
  margin-top: 12px !important;
}
.auth-foot {
  color: var(--muted);
  font-size: 12px;
}
.platform-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 23px 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(14px);
}
.platform-brand {
  padding: 0 9px 29px;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 10px;
  padding: 11px 12px;
  text-align: left;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}
.nav-item:hover {
  background: var(--soft);
  color: var(--ink);
}
.nav-item.active {
  color: var(--brand);
  background: var(--accent);
}
.side-foot {
  margin-top: auto;
  display: grid;
  gap: 5px;
}
.theme-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--soft);
  margin: 0 6px;
}
.logout {
  color: var(--muted);
}
.workspace {
  min-width: 0;
}
.workspace-header {
  height: 78px;
  padding: 0 32px;
  display: flex;
  gap: 22px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(15px);
  position: sticky;
  top: 0;
  z-index: 3;
}
.workspace-header h1 {
  font-size: 18px;
  margin-top: 2px;
}
.project-picker {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}
.project-picker select {
  min-height: 38px;
  max-width: 260px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-chip > span,
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--brand);
  font-weight: 700;
  flex: none;
}
.user-chip b,
.user-chip small {
  display: block;
  font-size: 11px;
}
.user-chip small {
  color: var(--muted);
  margin-top: 2px;
}
.content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 35px 32px;
}
.page-heading,
.module-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-heading h2,
.module-heading h2 {
  margin: 5px 0 6px;
}
.page-heading p,
.module-heading p {
  color: var(--muted);
  line-height: 1.5;
}
.module-heading.compact {
  margin-bottom: 18px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.project-card,
.info-card,
.metric-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  backdrop-filter: none;
}
.project-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}
.project-card-top,
.card-actions,
.lead-top,
.lead-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.project-glyph {
  width: 39px;
  height: 39px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--brand);
}
.project-card p,
.project-card-meta {
  color: var(--muted);
  font-size: 12px;
}
.project-card-meta {
  border-top: 1px solid var(--line);
  padding-top: 11px;
  display: flex;
  justify-content: space-between;
}
.card-actions {
  margin-top: 4px;
}
.empty {
  min-height: 240px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
  padding: 25px;
}
.empty h2,
.empty h3 {
  color: var(--ink);
}
.error-state h2 {
  color: var(--red);
}
.loading {
  padding: 40px;
  color: var(--muted);
}
.embed-page {
  height: calc(100vh - 148px);
  display: flex;
  flex-direction: column;
}
.amo-frame {
  flex: 1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(270px, 1fr));
  gap: 14px;
  overflow: auto;
  padding-bottom: 10px;
}
.bot-column {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 72%, transparent);
  border-radius: 14px;
  min-height: 500px;
  padding: 12px;
}
.bot-column header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 2px 12px;
}
.bot-column header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bot-column header > b {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.column-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}
.column-dot.nomersiz {
  background: #b1771d;
}
.column-dot.chek_yoq {
  background: #c24c61;
}
.column-dot.naqd {
  background: var(--brand);
}
.column-dot.chek_bor {
  background: var(--green);
}
.lead-stack {
  display: grid;
  gap: 9px;
}
.lead-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px;
  box-shadow: 0 2px 9px #00000008;
  cursor: pointer;
  transition:
    transform 0.16s,
    border-color 0.16s;
}
.lead-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}
.lead-card h3 {
  margin: 11px 0 5px;
}
.lead-card a {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.receipt {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 7px;
}
.receipt.yes {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 13%, transparent);
}
.receipt.no {
  color: var(--muted);
  background: var(--soft);
}
.lead-bottom {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 10px;
}
.sync-failed {
  color: var(--red);
}
.sync-pending {
  color: #a47621;
}
.sync-success {
  color: var(--green);
}
.empty-column {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px;
}
.load-more {
  width: 100%;
  padding: 9px;
  color: var(--brand);
  font-weight: 700;
  margin-top: 9px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.search {
  min-width: 260px;
}
.search input {
  background: var(--surface);
}
.chat-layout {
  height: calc(100vh - 149px);
  min-height: 590px;
  display: grid;
  grid-template-columns: 310px minmax(360px, 1fr) 230px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.chat-list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-list > header {
  padding: 17px 15px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-list h2 {
  font-size: 21px;
  margin-top: 3px;
}
.chat-tabs {
  display: flex;
  gap: 5px;
  overflow: auto;
  padding: 0 12px 12px;
}
.chat-tabs button {
  white-space: nowrap;
  background: var(--soft);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 11px;
  color: var(--muted);
}
.chat-tabs button.active {
  background: var(--accent);
  color: var(--brand);
  font-weight: 700;
}
.chat-tabs b {
  margin-left: 4px;
}
.chat-search {
  padding: 0 12px 12px;
}
.chat-search input {
  min-height: 37px;
}
.chat-people {
  overflow: auto;
}
.person {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 9px;
  align-items: center;
  text-align: left;
  padding: 11px 13px;
  background: transparent;
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.person:hover,
.person.selected {
  background: var(--soft);
}
.person b,
.person small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.person small,
.person time {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}
.person time {
  max-width: 48px;
}
.conversation {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(
      155deg,
      color-mix(in srgb, var(--brand) 4%, transparent),
      transparent 45%
    ),
    var(--surface);
}
.conversation-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
}
.profile-title {
  display: flex;
  text-align: left;
  gap: 9px;
  align-items: center;
  background: transparent;
}
.profile-title b,
.profile-title small {
  display: block;
}
.profile-title small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
.messages {
  flex: 1;
  overflow: auto;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 9px;
}
.message {
  display: flex;
}
.message.out {
  justify-content: flex-end;
}
.message > div {
  max-width: min(78%, 490px);
  background: var(--soft);
  border-radius: 13px 13px 13px 3px;
  padding: 9px 11px;
  line-height: 1.45;
}
.message.out > div {
  background: var(--brand);
  color: #fff;
  border-radius: 13px 13px 3px 13px;
}
.message small {
  display: block;
  opacity: 0.65;
  font-size: 10px;
  text-align: right;
  margin-top: 3px;
}
.message-file {
  font-weight: 700;
  color: inherit;
}
.empty-message {
  align-self: center;
  justify-self: center;
  color: var(--muted);
  font-size: 12px;
}
.composer {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  padding: 11px;
  border-top: 1px solid var(--line);
}
.composer input {
  min-height: 40px;
}
.file-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  font-size: 21px;
}
.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.profile-panel {
  border-left: 1px solid var(--line);
  padding: 19px 15px;
  overflow: auto;
}
.profile-panel header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.profile-panel h3 {
  margin-top: 5px;
  font-size: 17px;
}
.profile-panel dl {
  margin: 16px 0;
  display: grid;
  gap: 3px;
}
.profile-panel dt {
  color: var(--muted);
  font-size: 11px;
  margin-top: 10px;
}
.profile-panel dd {
  margin: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.chat-placeholder {
  display: grid;
  place-content: center;
  text-align: center;
  gap: 12px;
  color: var(--muted);
  padding: 35px;
}
.chat-placeholder svg {
  width: 42px;
  height: 42px;
  margin: auto;
  color: var(--brand);
}
.chat-placeholder h2 {
  color: var(--ink);
  font-size: 21px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-bottom: 16px;
}
.metric-grid article {
  padding: 18px;
}
.metric-grid small {
  display: block;
  color: var(--muted);
  margin-bottom: 7px;
}
.metric-grid b {
  font: 700 28px Space Grotesk;
}
.metric-grid .danger {
  color: var(--red);
}
.info-card {
  padding: 20px;
  max-width: 760px;
}
.info-card h3 {
  margin-bottom: 7px;
}
.info-card p {
  color: var(--muted);
  line-height: 1.55;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #17102077;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  position: relative;
  width: min(100%, 650px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 27px;
  box-shadow: 0 28px 70px #0007;
}
.modal h2 {
  margin: 5px 0;
}
.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  font-size: 28px;
  color: var(--muted);
  background: transparent;
}
.mapping {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--soft);
  display: grid;
  gap: 10px;
}
.mapping p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.payment-preview {
  border: 1px dashed var(--line);
  padding: 12px;
  border-radius: 11px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.payment-preview img {
  max-width: 170px;
  max-height: 130px;
  border-radius: 8px;
}
.bot-controls,
.admin-manager {
  margin-top: 23px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.bot-controls p {
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0 10px;
}
.bot-controls .btn {
  margin-right: 6px;
}
.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.admin-row b,
.admin-row small {
  display: block;
}
.admin-row small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 11px;
}
.notice {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  background: var(--soft);
  padding: 10px;
  border-radius: 8px;
}
.toast-region {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 20;
  display: grid;
  gap: 8px;
}
.toast {
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 10px;
  padding: 11px 14px;
  max-width: 340px;
}
.toast.error {
  background: var(--red);
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-bottom: 16px;
}
.metric-grid article {
  padding: 18px;
}
.metric-grid small {
  display: block;
  color: var(--muted);
  margin-bottom: 7px;
}
.metric-grid b {
  font: 700 28px Space Grotesk;
}
.metric-grid .danger {
  color: var(--red);
}
.info-card {
  padding: 20px;
  max-width: 760px;
}
.info-card h3 {
  margin-bottom: 7px;
}
.info-card p {
  color: var(--muted);
  line-height: 1.55;
}
.sync-list {
  margin-top: 18px;
  max-width: 760px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.sync-list > h3 {
  padding: 15px;
  border-bottom: 1px solid var(--line);
}
.sync-list article {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.sync-list article b,
.sync-list article small {
  display: block;
}
.sync-list article small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.sync-list .sync-error {
  grid-column: 2/-1;
  color: var(--red);
  overflow-wrap: anywhere;
}
.sync-list .load-more {
  margin: 10px;
  width: calc(100% - 20px);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #17102077;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  position: relative;
  width: min(100%, 650px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 27px;
  box-shadow: 0 28px 70px #0007;
}
.modal h2 {
  margin: 5px 0;
}
.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  font-size: 28px;
  color: var(--muted);
  background: transparent;
}
.mapping {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--soft);
  display: grid;
  gap: 10px;
}
.mapping p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.payment-preview {
  border: 1px dashed var(--line);
  padding: 12px;
  border-radius: 11px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.payment-preview img {
  max-width: 170px;
  max-height: 130px;
  border-radius: 8px;
}
.bot-controls,
.admin-manager {
  margin-top: 23px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.bot-controls p {
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0 10px;
}
.bot-controls .btn {
  margin-right: 6px;
}
.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.admin-row b,
.admin-row small {
  display: block;
}
.admin-row small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 11px;
}
.notice {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  background: var(--soft);
  padding: 10px;
  border-radius: 8px;
}
.toast-region {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 20;
  display: grid;
  gap: 8px;
}
.toast {
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 10px;
  padding: 11px 14px;
  max-width: 340px;
}
.toast.error {
  background: var(--red);
}
@media (max-width: 980px) {
  .platform-shell {
    grid-template-columns: 66px minmax(0, 1fr);
  }
  .sidebar {
    padding: 18px 9px;
  }
  .platform-brand {
    padding: 0 6px 25px;
  }
  .platform-brand > span:last-child,
  .nav-item span,
  .logout span {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 11px;
  }
  .theme-button {
    margin: auto;
  }
  .workspace-header {
    padding: 0 22px;
  }
  .content {
    padding: 27px 22px;
  }
  .chat-layout {
    grid-template-columns: 290px minmax(340px, 1fr);
  }
  .profile-panel {
    display: none;
  }
  .profile-panel.mobile-show {
    display: block;
    position: fixed;
    z-index: 8;
    right: 12px;
    top: 90px;
    width: 260px;
    max-height: 75vh;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
  }
}
@media (max-width: 680px) {
  .platform-shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    z-index: 8;
    top: auto;
    bottom: 0;
    height: 62px;
    width: 100%;
    padding: 7px 10px;
    border-right: 0;
    border-top: 1px solid var(--line);
    flex-direction: row;
    background: var(--surface);
  }
  .platform-brand,
  .side-foot .theme-button {
    display: none;
  }
  .sidebar nav {
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    gap: 2px;
  }
  .nav-item {
    font-size: 0;
    padding: 8px;
    gap: 0;
  }
  .nav-item svg {
    width: 20px;
    height: 20px;
  }
  .side-foot {
    margin: 0;
  }
  .side-foot .logout {
    display: none;
  }
  .workspace {
    padding-bottom: 62px;
  }
  .workspace-header {
    height: 66px;
    padding: 0 14px;
    gap: 9px;
  }
  .workspace-header h1 {
    font-size: 15px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .crumb {
    font-size: 9px;
  }
  .project-picker {
    margin-left: auto;
  }
  .project-picker span,
  .user-chip > div {
    display: none;
  }
  .project-picker select {
    width: 110px;
    padding: 0 6px;
    max-width: 110px;
  }
  .content {
    padding: 20px 14px;
  }
  .page-heading,
  .module-heading {
    display: grid;
    gap: 12px;
  }
  .page-heading .btn {
    width: 100%;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
  .embed-page {
    height: calc(100vh - 126px);
  }
  .kanban {
    grid-template-columns: repeat(4, 270px);
    margin: 0 -14px;
    padding: 0 14px 8px;
  }
  .search {
    min-width: 0;
  }
  .chat-layout {
    height: calc(100vh - 126px);
    min-height: 500px;
    display: block;
    border-radius: 12px;
  }
  .chat-list {
    height: 100%;
  }
  .conversation {
    position: fixed;
    inset: 66px 0 62px;
    z-index: 7;
    display: none;
  }
  .chat-list:has(.person.selected) + .conversation {
    display: flex;
  }
  .composer {
    grid-template-columns: 34px 1fr;
  }
  .composer .btn {
    grid-column: 2;
  }
  .modal-backdrop {
    padding: 9px;
    align-items: end;
  }
  .modal {
    max-height: 92vh;
    padding: 23px 18px;
    border-radius: 16px 16px 0 0;
  }
  .inline-form {
    grid-template-columns: 1fr;
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-card-meta {
    display: grid;
    gap: 5px;
  }
  .toast-region {
    bottom: 74px;
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: none;
  }
  .auth-card {
    padding: 25px;
  }
  .auth-shell {
    align-content: center;
  }
  .chat-tabs {
    padding-bottom: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* The pale dark-mode accent needs a dark foreground for readable primary actions. */
:root[data-theme="dark"] .btn.primary,
:root[data-theme="dark"] .btn.danger {
  color: #0f172a;
}

.header-theme {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  flex: none;
}
.header-logout {
  width: 40px;
  height: 40px;
  flex: none;
}
.chat-back {
  display: none;
  transform: rotate(180deg);
}
@media (max-width: 640px) {
  .workspace-header .user-chip {
    display: none;
  }
  .workspace-header h1 {
    max-width: 110px;
  }
  .project-picker select {
    width: 85px;
    max-width: 85px;
  }
  .header-theme,
  .header-logout {
    width: 36px;
    height: 36px;
  }
  .chat-back {
    display: grid;
  }
  .conversation-head {
    gap: 8px;
  }
  .profile-title {
    min-width: 0;
  }
  .profile-title b {
    overflow-wrap: anywhere;
  }
}

/* One calm workspace: glass chrome, opaque working surfaces. */
:root {
  --glass: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] {
  --glass: rgba(16, 27, 45, 0.84);
}
body {
  background: var(--paper);
  line-height: 1.5;
}
::selection {
  background: var(--accent);
  color: var(--ink);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
input,
textarea {
  caret-color: var(--brand);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
a {
  text-underline-offset: 3px;
}
h1,
h2,
h3 {
  text-wrap: balance;
}
.btn,
.icon-button,
.nav-item {
  touch-action: manipulation;
}
.platform-shell {
  grid-template-columns: 224px minmax(0, 1fr);
}
.sidebar {
  background: var(--glass);
  padding: 28px 14px 20px;
}
.platform-brand {
  padding-bottom: 36px;
}
.platform-brand small {
  letter-spacing: 0.8px;
  font-size: 9px;
}
.nav-item {
  min-height: 46px;
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 600;
}
.nav-item.active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent);
}
.workspace {
  min-width: 0;
}
.workspace-header {
  height: 80px;
  padding: 0 32px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  gap: 18px;
}
.workspace-header h1 {
  font-size: 20px;
  line-height: 1.4;
}
.crumb {
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
  font-weight: 500;
}
.content {
  padding: 28px 32px;
  max-width: 1800px;
  margin: 0 auto;
}
.page-heading,
.module-heading {
  margin-bottom: 24px;
  align-items: center;
}
.page-heading h2,
.module-heading h2 {
  font-size: 28px;
  letter-spacing: -0.7px;
}
.page-heading p,
.module-heading p {
  margin-top: 7px;
  max-width: 70ch;
  color: var(--muted);
}
.heading-count {
  font: 600 13px system-ui;
  color: var(--muted);
  background: var(--soft);
  border-radius: 8px;
  padding: 5px 8px;
  vertical-align: middle;
  margin-left: 7px;
}
.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 20px;
}
.project-card {
  padding: 22px;
  border-radius: 14px;
  box-shadow: none;
}
.project-card h3 {
  font-family:
    Space Grotesk,
    sans-serif;
  font-size: 20px;
  margin: 18px 0 6px;
}
.project-glyph {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}
.project-card p {
  font-size: 13px;
  line-height: 1.6;
}
.project-card-meta {
  font-size: 12px;
  margin-top: 20px;
  gap: 10px;
  flex-wrap: wrap;
}
.card-actions {
  gap: 10px;
  margin-top: 20px;
}
.card-actions .text-button {
  margin-right: auto;
}
.delete-button {
  color: var(--red);
  background: transparent;
}
.delete-button:hover {
  background: color-mix(in srgb, var(--red) 10%, transparent);
}
.embed-page {
  height: calc(100dvh - 136px);
  min-height: 480px;
}
.embed-page .module-heading {
  margin-bottom: 8px;
}
.embed-page .module-heading p {
  display: none;
}
.embed-page h2 {
  font-size: 23px;
}
.amo-frame {
  border: 0;
  border-radius: 0;
  background: transparent;
  flex: 1;
  width: 100%;
  min-height: 0;
}
.bot-column {
  border-radius: 14px;
  background: var(--soft);
  padding: 14px;
}
.bot-column header h3 {
  font-size: 14px;
}
.lead-card {
  box-shadow: none;
  border-radius: 12px;
  padding: 16px;
}
.lead-card:hover {
  transform: none;
}
.lead-bottom {
  font-size: 12px;
}
.phone-missing,
.empty-column {
  font-size: 13px;
}
.chat-tabs button {
  font-size: 12px;
  min-height: 36px;
}
.person small,
.message small {
  font-size: 12px;
}
.chat-layout {
  grid-template-columns: 300px minmax(0, 1fr) 220px;
  box-shadow: none;
  height: calc(100dvh - 136px);
  min-height: 480px;
}
.person {
  grid-template-columns: 34px minmax(0, 1fr);
}
.person time {
  grid-column: 2;
  font-size: 11px;
}
.modal-backdrop {
  background: rgba(8, 17, 31, 0.46);
}
.project-modal {
  width: min(100%, 720px);
  padding: 28px 32px;
}
.modal h2 {
  padding-right: 30px;
  font-size: 25px;
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  line-height: 1;
}
.modal-close:hover {
  background: var(--soft);
}
.mapping {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}
#mapping-fields {
  display: grid;
  gap: 10px;
}
.payment-preview {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 0 0;
}
.inline-form input {
  min-width: 0;
}
.delete-description {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.7;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.sync-pending {
  color: #88570d;
}
:root[data-theme="dark"] .sync-pending {
  color: #fbbf24;
}
@media (max-width: 1100px) {
  .chat-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .profile-panel {
    display: none;
  }
}
@media (min-width: 681px) and (max-width: 980px) {
  .platform-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .sidebar {
    padding: 24px 10px;
  }
}
@media (max-width: 680px) {
  .platform-shell {
    display: block;
  }
  .sidebar {
    padding: 6px 8px;
    height: 68px;
    background: var(--glass);
  }
  .sidebar nav {
    display: flex;
    justify-content: space-around;
  }
  .nav-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 3px;
    padding: 5px 2px;
    min-height: 52px;
    margin: 0;
    font-size: 10px;
  }
  .nav-item span {
    display: block;
    font-size: 9px;
    font-weight: 600;
  }
  .workspace {
    padding-bottom: 68px;
  }
  .workspace-header {
    height: 72px;
    padding: 0 12px;
    gap: 8px;
  }
  .workspace-header h1 {
    font-size: 15px;
    max-width: 104px;
  }
  .crumb {
    font-size: 10px;
  }
  .project-picker select {
    min-height: 38px;
  }
  .header-theme {
    margin: 0;
  }
  .content {
    padding: 22px 14px;
  }
  .page-heading h2,
  .module-heading h2 {
    font-size: 24px;
  }
  .page-heading p,
  .module-heading p {
    font-size: 13px;
  }
  .project-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .project-card {
    padding: 20px;
  }
  .embed-page {
    height: calc(100dvh - 162px);
    min-height: 0;
  }
  .embed-page .module-heading {
    display: flex;
    gap: 8px;
  }
  .embed-page h2 {
    font-size: 17px;
  }
  .embed-page .text-button {
    font-size: 11px;
    white-space: nowrap;
  }
  .chat-layout {
    display: block;
    height: calc(100dvh - 162px);
    min-height: 0;
  }
  .conversation {
    inset: 72px 0 68px;
  }
  .project-modal {
    padding: 24px 18px;
  }
  .kanban {
    scroll-snap-type: x proximity;
  }
  .bot-column {
    scroll-snap-align: start;
  }
}

:root[data-theme="dark"] .logo {
  color: #08111f;
}

/* Operational summary and an explicit, persistent navigation toggle. */
[hidden] {
  display: none !important;
}
.workspace-title {
  min-width: 0;
}
.workspace-title h1 {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sidebar-toggle {
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--soft);
}
.platform-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}
.sidebar-collapsed > .sidebar {
  transform: translateX(-105%);
  visibility: hidden;
  pointer-events: none;
}
.sidebar {
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}
.bot-statistics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.bot-stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 18px;
  display: grid;
  gap: 12px;
}
.bot-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.bot-stat-label svg {
  flex: none;
  color: var(--brand);
  width: 16px;
  height: 16px;
}
.bot-stat strong {
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.7px;
}
.bot-stat small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
@media (max-width: 1100px) {
  .bot-statistics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  .workspace-title {
    flex: 1;
  }
  .workspace-title h1 {
    max-width: 100%;
  }
  .sidebar-toggle {
    width: 36px;
    height: 36px;
  }
  .sidebar-collapsed > .workspace {
    padding-bottom: 0;
  }
  .bot-statistics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
  }
  .bot-stat {
    padding: 14px;
    gap: 10px;
  }
  .bot-stat strong {
    font-size: 26px;
  }
  .bot-stat:last-child {
    grid-column: 1 / -1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}
