/* sales.identify.uz — toza, yorug' SaaS panel (indigo aksent) */

:root {
  --bg: #f4f5fa;
  --card: #ffffff;
  --line: #e9eaf2;
  --ink: #101225;
  --muted: #878ca0;
  --violet: #4f46e5;
  --violet-dark: #4038c7;
  --violet-pale: #eef0fe;
  --green: #16a34a;
  --green-pale: #e8f7ee;
  --amber: #d97706;
  --amber-pale: #fcf1df;
  --red: #dc2626;
  --red-pale: #fdecec;
  --sidebar: #161232;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 18, 37, 0.05), 0 4px 16px rgba(16, 18, 37, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: "Plus Jakarta Sans", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 76px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.brand-mark {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}

.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.nav a {
  width: 44px; height: 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  color: #8f8bb8;
  transition: background 0.18s, color 0.18s;
  position: relative;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.nav a.active { color: #fff; background: var(--violet); box-shadow: 0 4px 14px rgba(79, 70, 229, 0.5); }
.nav a svg { width: 21px; height: 21px; }

.nav a .tip {
  position: absolute; left: 56px; top: 50%;
  transform: translateY(-50%);
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 8px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
  z-index: 30;
}
.nav a:hover .tip { opacity: 1; }

.nav-bottom { display: flex; flex-direction: column; gap: 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.who { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--green);
  color: var(--ink);
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
}

.who b { font-size: 15.5px; display: block; }
.who span { font-size: 12.5px; color: var(--muted); }

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

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px; font-weight: 600;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-pale); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px var(--red-pale); }

/* --------------------------------------------------------------- content */
.content { padding: 28px 32px 48px; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 { font-size: 27px; font-weight: 800; letter-spacing: -0.4px; }
.page-head p { color: var(--muted); margin-top: 3px; font-size: 13.5px; }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat { position: relative; animation: fadeUp 0.45s ease both; }
.stat:nth-child(2) { animation-delay: 0.06s; }
.stat:nth-child(3) { animation-delay: 0.12s; }
.stat:nth-child(4) { animation-delay: 0.18s; }

.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .num { font-size: 36px; font-weight: 800; letter-spacing: -1px; margin-top: 10px; }
.stat .num small { font-size: 17px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.chip {
  position: absolute; top: 18px; right: 18px;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--violet-pale); color: var(--violet);
}
.chip.green { background: var(--green-pale); color: var(--green); }
.chip.amber { background: var(--amber-pale); color: var(--amber); }
.chip svg { width: 20px; height: 20px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--violet); color: #fff;
  border: none; border-radius: 12px;
  padding: 10px 18px;
  font: 600 14px "Plus Jakarta Sans", sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--violet-dark); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }

.btn-ghost {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--bg); }

.btn-danger { background: var(--red); box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25); }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge.new { background: var(--violet-pale); color: var(--violet); }
.badge.progress { background: var(--amber-pale); color: var(--amber); }
.badge.won { background: var(--green-pale); color: var(--green); }
.badge.lost { background: var(--red-pale); color: var(--red); }
.badge.ai { background: var(--violet-pale); color: var(--violet); }
.badge.operator { background: var(--amber-pale); color: var(--amber); }

/* ----------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #fafafe; }

/* ----------------------------------------------------------------- forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], textarea, select {
  width: 100%;
  border: 1px solid #e2e4ef;
  border-radius: 12px;
  background: var(--card);
  padding: 11px 14px;
  font: 500 14px "Plus Jakarta Sans", sans-serif;
  color: var(--ink);
  transition: border 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.13);
}
textarea { min-height: 220px; resize: vertical; line-height: 1.6; }

select.inline { width: auto; padding: 6px 30px 6px 11px; font-size: 13px; border-radius: 10px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { display: none; }
.switch .track {
  width: 44px; height: 25px; border-radius: 999px;
  background: #d8daea; position: relative; transition: background 0.18s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left 0.18s;
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 22px; }

/* ----------------------------------------------------------------- alerts */
.alert {
  padding: 12px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; margin-bottom: 16px;
}
.alert.err { background: var(--red-pale); color: var(--red); }
.alert.ok { background: var(--green-pale); color: var(--green); }

/* ------------------------------------------------------------------ auth */
.auth-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(99, 102, 241, 0.09), transparent 60%),
    radial-gradient(500px 380px at 90% 85%, rgba(22, 163, 74, 0.07), transparent 60%),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 410px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 34px;
  animation: fadeUp 0.45s ease both;
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.auth-brand .brand-mark { margin: 0; }
.auth-brand b { font-size: 16px; }
.auth-brand span { display: block; font-size: 12px; color: var(--muted); }
.auth-card h1 { font-size: 21px; font-weight: 800; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-foot { margin-top: 18px; font-size: 13.5px; color: var(--muted); text-align: center; }
.auth-foot a { color: var(--violet); font-weight: 700; }
.btn-block { width: 100%; justify-content: center; padding: 12px; }

/* ------------------------------------------------------------------ chat */
.chat-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}
.chat-list-item:last-child { border-bottom: none; }
.chat-list-item:hover { background: #fafafe; }
.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--violet-pale); color: var(--violet);
  display: grid; place-items: center;
  font-weight: 800; flex-shrink: 0;
}
.chat-list-item .meta { flex: 1; min-width: 0; }
.chat-list-item .meta b { display: block; font-size: 14.5px; }
.chat-list-item .meta span {
  display: block; color: var(--muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-list-item time { font-size: 12px; color: var(--muted); flex-shrink: 0; }

.chat-box { display: flex; flex-direction: column; height: calc(100vh - 235px); min-height: 420px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }

.msg { display: flex; }
.msg.user { justify-content: flex-start; }
.msg.assistant, .msg.operator { justify-content: flex-end; }
.bubble {
  max-width: 64%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  white-space: pre-wrap; word-wrap: break-word;
  animation: fadeUp 0.3s ease both;
}
.msg.user .bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.assistant .bubble { background: var(--violet-pale); border-bottom-right-radius: 6px; }
.msg.operator .bubble { background: var(--green-pale); border-bottom-right-radius: 6px; }
.bubble .b-meta { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; font-weight: 600; }

.chat-send { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.chat-send input { flex: 1; }

/* ----------------------------------------------------------------- steps */
.steps { display: flex; gap: 8px; margin-bottom: 22px; }
.step-dot {
  flex: 1; height: 5px; border-radius: 999px;
  background: var(--line);
}
.step-dot.done { background: var(--violet); }

.empty {
  text-align: center; color: var(--muted);
  padding: 46px 20px; font-size: 14px;
}
.empty b { display: block; font-size: 16px; color: var(--ink); margin-bottom: 5px; }

.mb { margin-bottom: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------------------------------------------------------------- kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}
.kanban-col {
  background: #eef0f7;
  border-radius: var(--radius);
  padding: 10px;
  min-height: 240px;
}
.kanban-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 10px;
}
.kanban-body { display: flex; flex-direction: column; gap: 8px; min-height: 160px; border-radius: 10px; transition: background 0.15s; }
.kanban-body.over { background: rgba(79, 70, 229, 0.08); }
.kanban-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(16, 18, 37, 0.05);
  font-size: 13.5px;
}
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }

/* -------------------------------------------------------------- feedback */
.fb { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.fb form { display: inline; }
.fb-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; opacity: 0.35; padding: 1px 3px; border-radius: 6px;
  transition: opacity 0.12s, background 0.12s;
}
.fb-btn:hover { opacity: 1; background: rgba(16, 18, 37, 0.06); }
.fb-btn.on { opacity: 1; background: var(--green-pale); }
.fb-btn.on-down { opacity: 1; background: var(--red-pale); }

@media (max-width: 1000px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 14px 16px; }
  .bubble { max-width: 85%; }
}
