:root {
  --bg: #ececef;
  --ink: #121212;
  --mute: #6b6b73;
  --lime: #d4ff5e;
  --lime-deep: #b6e038;
  --dark: #141414;
  --dark-2: #1e1e1e;
  --dark-3: #2a2a2a;
  --line: #e2e2e6;
  --lavender: #ebe3f7;
  --soft-red: #ffe3e0;
  --ok: #1f8a5b;
  --warn: #c47a12;
  --bad: #d64545;
  --surface: #ffffff;
  --r: 28px;
  --r-sm: 18px;
  --r-pill: 999px;
  --font: "Syne", "Source Sans 3", system-ui, sans-serif;
  --body: "Source Sans 3", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rail: 72px;
  --sidebar: min(360px, 34vw);
  --aside: min(300px, 28vw);
}

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body.lk-body {
  margin: 0;
  min-height: 100%;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--lime-deep); outline-offset: 2px; }

.lk-app {
  display: grid;
  grid-template-columns: var(--rail) var(--sidebar) minmax(0, 1fr) var(--aside);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.lk-rail {
  background: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 10px;
}

.lk-rail-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 800;
  font-family: var(--font);
}

.lk-rail-btn.is-active,
.lk-rail-btn:hover {
  background: var(--lime);
  color: var(--ink);
}

.lk-rail-spacer { flex: 1; }

.lk-side {
  background: var(--dark-2);
  color: #fff;
  padding: 16px 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lk-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lk-side-head strong {
  font-family: var(--font);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.lk-sound-toggle {
  border: 0;
  border-radius: var(--r-pill);
  min-height: 34px;
  padding: 0 12px;
  background: var(--dark-3);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.lk-sound-toggle.is-on {
  background: var(--lime);
  color: var(--ink);
}

.lk-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lk-metric {
  background: var(--dark-3);
  border-radius: 18px;
  padding: 12px;
}

.lk-metric b {
  display: block;
  font-family: var(--font);
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.lk-metric span {
  color: #a7a7ad;
  font-size: 0.78rem;
}

.lk-filters {
  display: grid;
  gap: 8px;
}

.lk-filters input[type="search"] {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: var(--r-pill);
  padding: 0 14px;
  background: var(--dark-3);
  color: #fff;
  font: inherit;
}

.lk-filters input::placeholder { color: #8d8d95; }

.lk-lead-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 20px;
}

.lk-lead-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: start;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 22px;
  padding: 12px;
  background: var(--dark-3);
  color: #fff;
  cursor: pointer;
  font: inherit;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}

.lk-lead-card:hover { background: #323232; }
.lk-lead-card.is-active {
  background: var(--lime);
  color: var(--ink);
}

.lk-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #3a3a40;
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.85rem;
}

.lk-lead-card.is-active .lk-avatar {
  background: rgba(0,0,0,.12);
}

.lk-lead-card h3 {
  margin: 0 0 2px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lk-lead-card small {
  display: block;
  opacity: 0.75;
  font-size: 0.78rem;
}

.lk-lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.lk-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255,255,255,.1);
}

.lk-lead-card.is-active .lk-chip {
  background: rgba(0,0,0,.12);
}

.lk-chip.is-new { background: #fff1d6; color: #8a4f00; }
.lk-chip.is-in_progress { background: #dff0ff; color: #0d5cab; }
.lk-chip.is-done { background: #dff7eb; color: #0f6b45; }
.lk-chip.is-cancelled { background: var(--soft-red); color: var(--bad); }
.lk-chip.is-site { background: #e8fff4; color: var(--ok); }
.lk-chip.is-telegram { background: #e8f1ff; color: #2a6ec8; }

.lk-main {
  overflow: auto;
  padding: 18px;
  background:
    radial-gradient(800px 400px at 100% 0%, rgba(212,255,94,.18), transparent 55%),
    var(--bg);
}

.lk-main-empty {
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--mute);
  background: rgba(255,255,255,.55);
  border-radius: var(--r);
  border: 1px dashed #d5d5da;
}

.lk-main-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.3rem;
}

.lk-profile {
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: var(--r);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.lk-profile-top {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 16px;
  align-items: start;
}

.lk-profile-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(145deg, #dfe7f5, #c8d7ef);
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.5rem;
}

.lk-lead-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-family: var(--font);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.lk-lead-title-line {
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mute);
  letter-spacing: 0;
}

.lk-profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.lk-contact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.lk-contact-btn,
.lk-mini-btn,
.lk-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--lime);
  color: var(--ink);
  transition: transform 0.15s var(--ease), filter 0.15s ease;
}

.lk-contact-btn:hover,
.lk-mini-btn:hover,
.lk-btn:hover {
  filter: brightness(0.97);
  transform: translateY(-1px);
  text-decoration: none;
}

.lk-contact-btn.is-soft,
.lk-btn-ghost,
.lk-mini-btn {
  background: #fff;
  border: 1px solid var(--line);
}

.lk-contact-btn.is-tg { background: #eaf2ff; border: 0; }
.lk-contact-btn.is-max { background: var(--lavender); border: 0; }
.lk-btn-danger,
.lk-mini-btn.is-danger {
  background: var(--soft-red);
  color: var(--bad);
  border: 0;
}

.lk-btn-sm,
.lk-mini-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.lk-preset {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f7f7f9;
  color: var(--mute);
  font-size: 0.9rem;
}

.lk-tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0 12px;
  overflow: auto;
}

.lk-tab {
  border: 0;
  background: transparent;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font: inherit;
  font-weight: 700;
  color: var(--mute);
  cursor: pointer;
  white-space: nowrap;
}

.lk-tab.is-active {
  background: var(--ink);
  color: #fff;
}

.lk-panel-card {
  background: #fff;
  border-radius: var(--r);
  padding: 16px;
  border: 1px solid var(--line);
}

.lk-kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 12px;
  margin: 0;
}

.lk-kv dt { color: var(--mute); font-size: 0.88rem; }
.lk-kv dd { margin: 0; font-weight: 600; word-break: break-word; }

.lk-comments { display: grid; gap: 8px; margin-bottom: 12px; }

.lk-comment {
  background: #f7f7f9;
  border-radius: 16px;
  padding: 12px;
}

.lk-comment header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.lk-comment header time { color: var(--mute); }
.lk-comment p { margin: 0; white-space: pre-wrap; }

.lk-comment-form textarea,
.lk-field textarea,
.lk-inline-comment textarea {
  width: 100%;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  font: inherit;
  resize: vertical;
  background: #fff;
}

.lk-aside {
  overflow: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lk-widget {
  border-radius: var(--r);
  padding: 16px;
}

.lk-widget-lavender { background: var(--lavender); }
.lk-widget-lime { background: var(--lime); }
.lk-widget-white {
  background: #fff;
  border: 1px solid var(--line);
}

.lk-widget h2 {
  margin: 0 0 12px;
  font-family: var(--font);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.lk-widget .big {
  font-family: var(--font);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 8px 0 12px;
}

.lk-field { display: grid; gap: 6px; margin-bottom: 10px; }
.lk-field-label,
.lk-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--mute);
}

.lk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lk-sep { border: 0; border-top: 1px solid rgba(0,0,0,.08); margin: 14px 0; }
.lk-feedback { min-height: 1.2em; margin: 8px 0 0; font-size: 0.88rem; color: var(--ok); }
.lk-feedback.is-bad { color: var(--bad); }
.lk-quiet { color: var(--mute); font-size: 0.86rem; }
.lk-empty-mini {
  padding: 18px;
  text-align: center;
  color: #9a9aa3;
  font-size: 0.88rem;
}

.lk-select { position: relative; width: 100%; }
.lk-select-trigger {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.lk-side .lk-select-trigger {
  background: var(--dark-3);
  color: #fff;
}

.lk-select-caret {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.7;
}

.lk-select-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #fff;
  color: var(--ink);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,.16);
  max-height: 240px;
  overflow: auto;
}

.lk-select-menu [role="option"] {
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

.lk-select-menu [role="option"]:hover,
.lk-select-menu [role="option"][aria-selected="true"] {
  background: var(--lime);
}

.lk-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .25s var(--ease);
}

.lk-toast.is-on {
  transform: none;
  opacity: 1;
}

.lk-mobile-bar {
  display: none;
}

.lk-login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.lk-login-stage {
  background:
    radial-gradient(700px 400px at 20% 20%, rgba(212,255,94,.35), transparent 55%),
    var(--dark);
  color: #fff;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 0 var(--r) var(--r) 0;
}

.lk-login-stage h1 {
  margin: 0;
  max-width: 8ch;
  font-family: var(--font);
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.lk-login-stage p {
  margin: 14px 0 0;
  max-width: 28ch;
  color: rgba(255,255,255,.75);
}

.lk-login-panel {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.lk-login {
  width: min(400px, 100%);
}

.lk-login h2 {
  margin: 0 0 6px;
  font-family: var(--font);
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.lk-login > p { margin: 0 0 22px; color: var(--mute); }

.lk-login .lk-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  font: inherit;
  background: #fff;
}

.lk-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--mute);
  margin: 4px 0 10px;
}

.lk-alert {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #fff4e5;
  color: #8a4b00;
}

.lk-alert.is-danger { background: var(--soft-red); color: var(--bad); }
.lk-login .lk-btn { width: 100%; min-height: 46px; }
.lk-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0);
}

@media (max-width: 1100px) {
  .lk-app {
    grid-template-columns: var(--rail) minmax(280px, 40vw) minmax(0, 1fr);
  }
  .lk-aside { display: none; }
  .lk-aside.is-open-mobile {
    display: flex;
    position: fixed;
    inset: 0 0 0 auto;
    width: min(340px, 92vw);
    z-index: 60;
    background: var(--bg);
    box-shadow: -20px 0 50px rgba(0,0,0,.2);
  }
}

@media (max-width: 860px) {
  .lk-app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding-bottom: 64px;
  }
  .lk-rail { display: none; }
  .lk-side {
    position: sticky;
    top: 0;
    z-index: 20;
    max-height: 42vh;
  }
  .lk-main { padding: 12px; }
  .lk-profile-top {
    grid-template-columns: 56px 1fr;
  }
  .lk-profile-photo {
    width: 56px;
    height: 56px;
    font-size: 1.1rem;
  }
  .lk-profile-tags { grid-column: 1 / -1; justify-content: flex-start; }
  .lk-kv { grid-template-columns: 1fr; gap: 4px; }
  .lk-metrics { grid-template-columns: repeat(4, minmax(70px, 1fr)); overflow: auto; }
  .lk-metric { min-width: 78px; padding: 10px; }
  .lk-metric b { font-size: 1.1rem; }
  .lk-mobile-bar {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 70;
    gap: 8px;
    padding: 8px;
    border-radius: 20px;
    background: rgba(20,20,20,.92);
    backdrop-filter: blur(8px);
  }
  .lk-mobile-bar button {
    flex: 1;
    min-height: 42px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }
  .lk-mobile-bar button.is-active {
    background: var(--lime);
    color: var(--ink);
  }
  .lk-app.is-show-list .lk-main,
  .lk-app.is-show-list .lk-aside { display: none; }
  .lk-app.is-show-detail .lk-side { display: none; }
  .lk-app.is-show-detail .lk-aside { display: none; }
  .lk-app.is-show-tools .lk-side,
  .lk-app.is-show-tools .lk-main { display: none; }
  .lk-app.is-show-tools .lk-aside {
    display: flex;
    position: static;
    width: auto;
    box-shadow: none;
    min-height: calc(100vh - 80px);
  }
  .lk-login-page { grid-template-columns: 1fr; }
  .lk-login-stage {
    border-radius: 0 0 var(--r) var(--r);
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
