/* CRM «Эталон Сервис» — тёмный премиум + золото */
:root {
  --bg: #101216;
  --bg2: #171a20;
  --card: #1d212a;
  --card2: #242936;
  --line: #2e3442;
  --text: #e8e6e1;
  --muted: #9aa0ad;
  --gold: #c9a227;
  --gold2: #e6c35c;
  --green: #4caf7d;
  --red: #e05c5c;
  --blue: #5c8fe0;
  --orange: #e0a05c;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
}
button { font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
a { color: var(--gold2); text-decoration: none; }

.hidden { display: none !important; }

/* ---------- вход ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #1e2330 0%, var(--bg) 60%);
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.login-box h1 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: .5px;
}
.login-box .sub { text-align: center; color: var(--gold); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 24px; }
.login-box button { margin-top: 18px; }

/* ---------- каркас ---------- */
#app { display: flex; min-height: 100vh; }
aside {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 6px 10px 18px; }
.brand b { font-size: 17px; letter-spacing: .5px; }
.brand span { display: block; color: var(--gold); font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; margin-top: 2px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}
.nav-btn:hover { background: var(--card); color: var(--text); }
.nav-btn.active { background: linear-gradient(90deg, rgba(201,162,39,.16), rgba(201,162,39,.05)); color: var(--gold2); }
.nav-btn .ico { width: 20px; text-align: center; }
.nav-spacer { flex: 1; }
.me-box { padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.me-box b { display: block; color: var(--text); font-size: 14px; }

main { flex: 1; padding: 24px 28px 90px; max-width: 1400px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  background: var(--card2);
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn.gold { background: linear-gradient(135deg, var(--gold), #a8861e); color: #14161a; font-weight: 600; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: rgba(224,92,92,.14); color: var(--red); }
.btn.ghost { background: none; border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.wide { width: 100%; }

/* ---------- карточки/таблицы ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat .val { font-size: 26px; font-weight: 700; }
.stat .val small { font-size: 14px; color: var(--muted); font-weight: 400; }
.stat.gold-b { border-color: rgba(201,162,39,.5); }

.progress-wrap { background: var(--bg2); border-radius: 99px; height: 14px; overflow: hidden; margin-top: 10px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); border-radius: 99px; transition: width .5s; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid rgba(46,52,66,.55); vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(201,162,39,.05); }
.table-scroll { overflow-x: auto; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.b-gray { background: rgba(154,160,173,.15); color: var(--muted); }
.b-gold { background: rgba(201,162,39,.16); color: var(--gold2); }
.b-green { background: rgba(76,175,125,.16); color: var(--green); }
.b-red { background: rgba(224,92,92,.15); color: var(--red); }
.b-blue { background: rgba(92,143,224,.16); color: var(--blue); }
.b-orange { background: rgba(224,160,92,.16); color: var(--orange); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.mt { margin-top: 14px; }
.section-title { font-size: 16px; font-weight: 600; margin: 22px 0 10px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- канбан ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kb-col { min-width: 250px; width: 250px; flex-shrink: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); }
.kb-head { padding: 12px 14px; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.kb-head .cnt { color: var(--muted); font-weight: 400; font-size: 12px; }
.kb-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kb-col.drag-over { border-color: var(--gold); }
.lead-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
}
.lead-card:hover { border-color: var(--gold); }
.lead-card b { display: block; margin-bottom: 3px; }
.lead-card .lc-row { color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px; margin-top: 3px; }
.lead-card .warn { color: var(--orange); }
.lead-card .over { color: var(--red); }

/* ---------- модалки ---------- */
#modal-back {
  position: fixed; inset: 0; background: rgba(8,10,14,.72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  width: 100%; max-width: 560px; padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.modal.big { max-width: 760px; }
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; flex-wrap: wrap; }

.note-item { border-left: 2px solid var(--gold); padding: 6px 12px; margin: 8px 0; background: var(--bg2); border-radius: 0 8px 8px 0; }
.note-item .small { margin-top: 2px; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid rgba(46,52,66,.55); }
.list-item .grow { flex: 1; min-width: 0; }

.task-check {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--muted);
  background: none; cursor: pointer; flex-shrink: 0; color: transparent; font-size: 13px; line-height: 1;
}
.task-check.done { background: var(--green); border-color: var(--green); color: #fff; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--gold); color: var(--text);
  padding: 12px 22px; border-radius: 12px; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

.funnel-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.funnel-row .fl { width: 130px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.funnel-row .fb { height: 22px; background: linear-gradient(90deg, var(--gold), rgba(201,162,39,.35)); border-radius: 6px; min-width: 4px; }
.funnel-row .fn { font-size: 13px; white-space: nowrap; }

/* ---------- мобильная версия ---------- */
#mobile-nav { display: none; }
@media (max-width: 800px) {
  aside { display: none; }
  main { padding: 16px 12px 90px; }
  .grid2 { grid-template-columns: 1fr; }
  #mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg2); border-top: 1px solid var(--line); z-index: 40;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  #mobile-nav .nav-btn { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 2px; align-items: center; flex: 1; }
  #mobile-nav .ico { font-size: 19px; }
  .kb-col { min-width: 230px; width: 230px; }
  .page-head h2 { font-size: 19px; }
}
