/* ───────── SalesDrive · базовые токены и компоненты ───────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-cyrillic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #050a17;
  --bg-side: #070d1c;
  --card: #0b1326;
  --card-2: #0f1830;
  --card-hi: #131e3a;
  --line: #16213e;
  --line-2: #1f2d52;
  --text: #f2f5ff;
  --text-2: #a4b0ca;
  --text-3: #6d7b99;
  --blue: #3b82f6;
  --blue-2: #2f6ff0;
  --blue-soft: #5b9bff;
  --gold: #f6c343;
  --green: #2fd07a;
  --red: #ff5a5f;
  --orange: #ff8a3d;
  --purple: #9b7bff;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 13px/1.4 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: rgba(59, 130, 246, .4); }
:focus-visible { outline: 2px solid var(--blue-soft); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1a2647; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.ic { flex: none; display: inline-block; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.nowrap { white-space: nowrap; }

/* ───────── тона (цвета иконок заданий/достижений) ───────── */
.tone-blue { --tone: #4f8cff; }
.tone-green { --tone: #2fd07a; }
.tone-orange { --tone: #ff8a3d; }
.tone-purple { --tone: #9b7bff; }
.tone-amber { --tone: #f5b93b; }
.tone-gold { --tone: #f7c948; }
.tone-yellow { --tone: #ffd34d; }
.tone-red { --tone: #ff5a5f; }
.tone-teal { --tone: #2dd4bf; }
.tone-pink { --tone: #ff6fa8; }

/* ───────── аватар ───────── */
.av {
  --s: 32px;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  display: inline-grid; place-items: center;
  flex: none;
  font-weight: 700;
  font-size: calc(var(--s) * .38);
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .95);
  background: linear-gradient(135deg, var(--g1), var(--g2));
  object-fit: cover;
  overflow: hidden;
  user-select: none;
}
.av--0 { --g1: #4f7cff; --g2: #2b3fa8; }
.av--1 { --g1: #e0679b; --g2: #8e2d63; }
.av--2 { --g1: #2fb59a; --g2: #17605a; }
.av--3 { --g1: #f0a04b; --g2: #a3521c; }
.av--4 { --g1: #8b6cf0; --g2: #47309e; }
.av--5 { --g1: #3fb0e8; --g2: #1a5f94; }
.av--6 { --g1: #e0605a; --g2: #86282b; }
.av--7 { --g1: #67c46a; --g2: #2c7a3a; }

/* ───────── кнопки ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 16px;
  border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--card-hi); color: var(--text);
  font-weight: 600; font-size: 13px;
  transition: background .15s, border-color .15s, transform .05s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: #18254a; border-color: #2b3c69; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: linear-gradient(180deg, #3b82f6, #2563eb); border-color: #4b8dff; box-shadow: 0 6px 18px rgba(37, 99, 235, .35); }
.btn--primary:hover { background: linear-gradient(180deg, #4c8ffb, #2b6df0); border-color: #6aa1ff; }
.btn--danger { background: rgba(255, 90, 95, .12); border-color: rgba(255, 90, 95, .4); color: #ff8b8f; }
.btn--danger:hover { background: rgba(255, 90, 95, .2); border-color: rgba(255, 90, 95, .6); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: rgba(255, 255, 255, .05); border-color: transparent; color: var(--text); }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn--icon { width: 30px; padding: 0; }

/* ───────── формы ───────── */
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: #08101f; border: 1px solid var(--line-2); border-radius: 9px;
  color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: #2a3a66; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa8c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select option { background: #0b1326; color: var(--text); }
.field--row { grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); font-size: 13px; user-select: none; }
.check input { appearance: none; width: 16px; height: 16px; margin: 0; border-radius: 4px; border: 1px solid #2f4070; background: #08101f; display: grid; place-items: center; cursor: pointer; transition: .15s; }
.check input:checked { background: var(--blue); border-color: var(--blue); }
.check input:checked::after { content: ''; width: 8px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.form-error { color: #ff8b8f; font-size: 12.5px; min-height: 18px; }

/* ───────── карточка ───────── */
.card {
  background: linear-gradient(180deg, rgba(15, 24, 46, .92), rgba(10, 18, 36, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ───────── прогресс ───────── */
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f6ff0, #5aa0ff); min-width: 0; transition: width .5s cubic-bezier(.2, .7, .2, 1); }
.bar--green > i { background: linear-gradient(90deg, #1fae62, #3fe08d); }
.bar--gold > i { background: linear-gradient(90deg, #d9a326, #ffd766); }
.bar--bronze > i { background: linear-gradient(90deg, #c46a3f, #f0a06b); }

/* ───────── пилюли / метки ───────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 8px; background: rgba(8, 14, 30, .7);
  font-size: 12px; color: var(--text); white-space: nowrap;
}
.badge-ok { color: #57e3a0; background: rgba(47, 208, 122, .12); border: 1px solid rgba(47, 208, 122, .3); }
.badge-off { color: #ff8b8f; background: rgba(255, 90, 95, .1); border: 1px solid rgba(255, 90, 95, .3); }
.badge-blue { color: #8ab6ff; background: rgba(59, 130, 246, .14); border: 1px solid rgba(59, 130, 246, .35); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }

/* ───────── модальное окно ───────── */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(2, 5, 12, .72); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; animation: fade .15s ease-out;
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: linear-gradient(180deg, #0f1830, #0a1226); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: pop .18s ease-out;
}
.modal--wide { width: min(760px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal__head h3 { font-size: 17px; font-weight: 700; }
.modal__body { padding: 16px 22px 8px; display: grid; gap: 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ───────── тосты ───────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; }
.toast {
  min-width: 240px; max-width: 360px; padding: 12px 14px; border-radius: 10px;
  background: #0f1a33; border: 1px solid var(--line-2); box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: flex-start; font-size: 13px; animation: pop .2s ease-out;
}
.toast--ok { border-color: rgba(47, 208, 122, .45); }
.toast--ok .ic { color: var(--green); }
.toast--err { border-color: rgba(255, 90, 95, .5); }
.toast--err .ic { color: var(--red); }

/* ───────── таблицы CRM и списки ───────── */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--text-2); padding: 10px 12px; background: #0e1730; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .025); }

.empty { padding: 36px 16px; text-align: center; color: var(--text-2); display: grid; gap: 8px; justify-items: center; }
.empty .ic { color: var(--text-3); }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, #0d1630 25%, #142042 50%, #0d1630 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
