:root {
  --bg: #0e0f11;
  --panel: #16181b;
  --panel-2: #1d2024;
  --line: #2a2e33;
  --text: #e8e9eb;
  --muted: #8b9098;
  --accent: #f5a524;
  --accent-ink: #1a1203;
  --danger: #e5534b;
  --ok: #3fb950;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 16px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* шапка */
.top { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 54px;
  border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 800; letter-spacing: .08em; font-size: 13px; }
.brand b { color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.on, .nav a:hover { background: var(--panel-2); color: var(--text); }
.me { color: var(--muted); font-size: 13px; display: flex; gap: 14px; align-items: center; }
main { padding: 20px; }
.wrap { max-width: 1200px; margin: 0 auto; }

/* формы */
input, select, textarea { background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.danger { color: var(--danger); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.muted { color: var(--muted); }
.msg { background: var(--panel-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }

/* канбан */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 260px; }
.toolbar select { width: auto; }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: calc(100vh - 160px); }
.col { flex: 0 0 260px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 160px); }
.col-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.col-head .bar { height: 3px; border-radius: 2px; margin-bottom: 10px; }
.col-title { font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.col-sum { color: var(--muted); font-size: 12px; margin-top: 3px; }
.col-body { padding: 8px; overflow-y: auto; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.deal-card { display: block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; cursor: grab; }
.deal-card:hover { border-color: #3a3f46; color: var(--text); }
.deal-card .t { font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.deal-card .c { color: var(--muted); font-size: 12px; }
.deal-card .f { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; }
.deal-card .amt { font-weight: 700; }
.deal-card.free { border-style: dashed; }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 20px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.sortable-ghost { opacity: .35; }
.sortable-drag { transform: rotate(2deg); }

/* карточка сделки */
.layout { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.stagebar { display: flex; gap: 3px; margin: 4px 0 18px; }
.stagebar span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:hover td { background: rgba(255,255,255,.015); }
.timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.ev { border-left: 2px solid var(--line); padding: 2px 0 2px 12px; }
.ev.note { border-color: var(--accent); }
.ev.stage { border-color: #4c8dff; }
.ev.created { border-color: var(--ok); }
.ev .meta { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.ev .txt { white-space: pre-wrap; line-height: 1.45; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { width: 340px; padding: 28px; }
.login .brand { font-size: 16px; margin-bottom: 18px; }

@media (max-width: 860px) {
  .layout, .grid2 { grid-template-columns: 1fr; }
  .top { gap: 12px; padding: 0 12px; }
  .me span { display: none; }
  main { padding: 12px; }
  .toolbar input[type=search] { width: 100%; }
}

/* переписка */
.small { font-size: 12px; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 82%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 11px; }
.bubble.in { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; border-bottom-right-radius: 4px; background: #23201a; border-color: #3a3222; }
.bubble.ch-call { align-self: center; max-width: 95%; background: transparent; border-style: dashed; }
.bubble .meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-bottom: 4px; align-items: center; }
.bubble .subj { font-weight: 600; margin-bottom: 3px; }
.bubble .txt { white-space: pre-wrap; line-height: 1.45; word-break: break-word; }
.bubble.st-failed { border-color: var(--danger); }
.bubble audio { height: 32px; max-width: 100%; }
.reply { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.payrow { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.tag.pay-succeeded { color: var(--ok); border-color: var(--ok); }
.tag.pay-pending { color: var(--accent); border-color: var(--accent); }
.tag.pay-canceled, .tag.pay-error { color: var(--danger); border-color: var(--danger); }

/* склад и цены */
.stockrow, .pricecard, .filerow { padding: 9px 0; border-bottom: 1px solid var(--line); }
.pricecard.comp { padding-left: 12px; border-left: 2px solid var(--line); }
.pricegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin: 6px 0 2px; }
.ok { color: var(--ok); } .no { color: var(--danger); }
.filerow { display: flex; flex-direction: column; gap: 2px; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin: 0; color: var(--muted); font-size: 12px; }
label.check input { width: auto; }
