/* Демо «CRM»: ShopCRM */
:root {
  --bg: #f6f5fb;
  --white: #fff;
  --ink: #1c1830;
  --muted: #6f6b85;
  --line: #ebe8f4;
  --violet: #6d4aff;
  --violet-dark: #5a39e6;
  --violet-soft: #efeaff;
  --green: #15924a;
  --green-soft: #e4f6ea;
  --blue: #2a62d9;
  --blue-soft: #e5eeff;
  --amber: #b46a00;
  --amber-soft: #fdf0d8;
  --red: #c93a3a;
  --red-soft: #fde8e8;
  --radius: 16px;
  --side-w: 260px;
}

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

body {
  padding-top: var(--bar-h);
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.45 Manrope, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
}

/* ---------- общие элементы ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
}

.brand svg {
  width: 40px;
  height: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: var(--violet);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--violet-dark);
}

.btn--soft {
  background: var(--violet-soft);
  color: var(--violet);
}

.btn--soft:hover {
  background: #e4dcff;
}

.btn--text {
  color: var(--violet);
}

.btn--sm {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
}

.round {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.round svg {
  width: 22px;
  height: 22px;
}

.dot {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 9px;
  height: 9px;
  background: var(--violet);
  border: 2px solid var(--white);
  border-radius: 50%;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

input:focus,
select:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(109, 74, 255, .14);
}

input.is-error {
  border-color: var(--red);
}

/* ---------- регистрация ---------- */

.auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--bar-h));
  padding: 24px 16px;
  background: radial-gradient(900px 500px at 50% 0, #e9e2ff 0, var(--bg) 70%);
}

.auth__card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 32px;
  background: var(--white);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(60, 40, 140, .12);
}

.auth__card h1 {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.auth__card p {
  margin-top: -8px;
  color: var(--muted);
}

.auth__card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

/* ---------- каркас ---------- */

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--bar-h));
}

.side {
  position: sticky;
  top: var(--bar-h);
  align-self: start;
  height: calc(100vh - var(--bar-h));
  padding: 26px 16px;
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid var(--line);
}

.side .brand {
  padding: 0 14px;
}

.menu {
  display: grid;
  gap: 4px;
  margin-top: 30px;
}

.menu button {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  transition: background .2s ease, color .2s ease;
}

.menu button:hover {
  background: var(--bg);
}

.menu button.is-active {
  background: var(--violet-soft);
  color: var(--violet);
  font-weight: 700;
}

.menu svg {
  flex: none;
  width: 24px;
  height: 24px;
}

.menu i {
  min-width: 26px;
  margin-left: auto;
  padding: 2px 8px;
  background: var(--violet-soft);
  border-radius: 10px;
  color: var(--violet);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
}

.menu i:empty {
  display: none;
}

.main {
  min-width: 0;
  padding: 26px 32px 40px;
}

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

.top__title {
  min-width: 0;
  margin-right: auto;
}

.top h1 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

.top p {
  color: var(--muted);
  font-size: 17px;
}

.burger {
  display: none;
}

.period {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding-left: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.period svg {
  flex: none;
  width: 20px;
  height: 20px;
}

.period select {
  width: auto;
  height: 44px;
  padding: 0 12px 0 0;
  border: 0;
  font-weight: 600;
  box-shadow: none;
}

.avatar {
  flex: none;
  width: 46px;
  height: 46px;
  background: var(--violet-soft);
  border-radius: 50%;
  color: var(--violet);
  font-size: 18px;
  font-weight: 700;
}

.pop {
  position: relative;
}

.pop__panel {
  position: absolute;
  top: 54px;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 12px;
  width: 300px;
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(28, 24, 48, .12);
}

.pop__panel p {
  color: var(--muted);
  font-size: 13px;
}

.pop__panel span {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.view {
  margin-top: 26px;
}

/* ---------- карточки ---------- */

.panel {
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 19px;
  font-weight: 700;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--violet);
  font-size: 14px;
  font-weight: 700;
}

.link svg {
  width: 18px;
  height: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--violet-soft);
  border-radius: 14px;
  color: var(--violet);
}

.stat__icon svg {
  width: 26px;
  height: 26px;
}

.stat div > span:first-child {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat b {
  display: inline-block;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.delta svg {
  width: 14px;
  height: 14px;
}

.delta--down {
  color: var(--red);
}

.delta--down svg {
  transform: rotate(180deg);
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  margin-top: 20px;
}

.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.big {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

/* график */

.chart {
  width: 100%;
  height: auto;
  margin-top: 8px;
  overflow: visible;
}

.chart text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.chart .bar {
  fill: var(--violet);
  opacity: .85;
  transition: opacity .2s ease;
}

.chart .bar:hover {
  opacity: 1;
}

/* каналы */

.donut {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut svg {
  flex: none;
  width: 150px;
  height: 150px;
}

.donut text {
  font-family: inherit;
  text-anchor: middle;
}

.legend {
  display: grid;
  flex: 1;
  gap: 14px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend b {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}

/* задачи */

.tasks {
  display: grid;
  gap: 4px;
}

.task {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.task input {
  position: absolute;
  opacity: 0;
}

.task i {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #d5d0e6;
  border-radius: 7px;
  color: transparent;
  transition: background .2s ease, border-color .2s ease;
}

.task i svg {
  width: 16px;
  height: 16px;
}

.task input:checked + i {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--white);
}

.task input:checked ~ span {
  color: var(--muted);
  text-decoration: line-through;
}

.task input:focus-visible + i {
  box-shadow: 0 0 0 3px rgba(109, 74, 255, .25);
}

.task-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-add input {
  height: 40px;
}

/* таблицы */

.table-wrap {
  margin: 0 -24px -8px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 13px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: 24px;
}

th:last-child,
td:last-child {
  padding-right: 24px;
}

th {
  border-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

td.num,
th.num {
  text-align: right;
}

td.dim {
  color: var(--muted);
}

.thumb {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: 12px;
  background: var(--bg);
  border-radius: 10px;
  color: var(--violet);
  vertical-align: middle;
}

.thumb svg {
  width: 22px;
  height: 22px;
}

.thumb {
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}

.badge--green {
  background: var(--green-soft);
  color: var(--green);
}

.badge--blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge--grey {
  background: #eeedf3;
  color: #4d4963;
}

.badge--amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge--red {
  background: var(--red-soft);
  color: var(--red);
}

.badge--violet {
  background: var(--violet-soft);
  color: var(--violet);
}

select.badge {
  width: auto;
  height: 30px;
  padding: 0 8px;
  border: 0;
  cursor: pointer;
}

/* панель над списками */

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab {
  height: 40px;
  padding: 0 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.tab b {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 600;
}

.tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.tab.is-active b {
  color: #bdb8d6;
}

.find {
  position: relative;
  display: block;
  width: 260px;
  margin-left: auto;
}

.find svg {
  position: absolute;
  top: 12px;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.find input {
  height: 44px;
  padding-left: 42px;
}

.none {
  padding: 32px 0 24px;
  color: var(--muted);
  text-align: center;
}

/* сетка карточек */

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.tile__head .thumb {
  flex: none;
  width: 46px;
  height: 46px;
  margin: 0;
}

.tile__head b {
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.tile__head span {
  color: var(--muted);
  font-size: 13px;
}

.tile__head .switch {
  margin-left: auto;
}

.tile p {
  color: var(--muted);
  font-size: 14px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.facts span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.facts b {
  font-size: 15px;
  font-weight: 700;
}

.switch {
  position: relative;
  display: block;
  flex: none;
  width: 44px;
  height: 26px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch i {
  position: absolute;
  inset: 0;
  background: #d9d5e8;
  border-radius: 13px;
  transition: background .2s ease;
}

.switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: transform .2s ease;
}

.switch input:checked + i {
  background: var(--violet);
}

.switch input:checked + i::after {
  transform: translateX(18px);
}

.switch input:focus-visible + i {
  box-shadow: 0 0 0 3px rgba(109, 74, 255, .25);
}

/* полоски */

.meter {
  display: inline-block;
  width: 120px;
  height: 8px;
  margin-right: 10px;
  overflow: hidden;
  background: var(--bg);
  border-radius: 4px;
  vertical-align: middle;
}

.meter i {
  display: block;
  height: 100%;
  background: var(--violet);
  border-radius: 4px;
}

.meter--amber i {
  background: #e39a1a;
}

.meter--red i {
  background: var(--red);
}

.rank {
  display: grid;
  gap: 14px;
}

.rank li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  list-style: none;
}

.rank b {
  color: var(--muted);
  font-weight: 600;
}

.rank .meter {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
}

/* настройки */

.settings {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.form {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.row:first-of-type {
  border-top: 0;
}

.row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- окно и уведомление ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(28, 24, 48, .45);
}

.dialog {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
  background: var(--white);
  border-radius: 20px;
}

.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog h3 {
  font-size: 20px;
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 120;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  background: var(--ink);
  border-radius: 12px;
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  transform: translateX(-50%);
}

.shade {
  position: fixed;
  inset: var(--bar-h) 0 0 0;
  z-index: 40;
  background: rgba(28, 24, 48, .45);
}

/* ---------- планшет ---------- */

@media (max-width: 1280px) {
  :root {
    --side-w: 220px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1023px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: fixed;
    top: var(--bar-h);
    left: 0;
    z-index: 50;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

  .side.is-open {
    transform: none;
  }

  .burger {
    display: grid;
  }

  .main {
    padding: 20px 24px 32px;
  }

  .cols,
  .settings {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- телефон ---------- */

@media (max-width: 767px) {
  .main {
    padding: 16px 16px 32px;
  }

  .top {
    flex-wrap: wrap;
    gap: 10px;
  }

  .top__title {
    flex: 1;
  }

  .top h1 {
    font-size: 22px;
  }

  .top p {
    display: none;
  }

  .round,
  .avatar {
    width: 42px;
    height: 42px;
  }

  .period {
    order: 1;
    width: 100%;
  }

  .period select {
    flex: 1;
    font-size: 16px;
  }

  .pop__panel {
    right: -52px;
    width: min(300px, calc(100vw - 32px));
  }

  .view {
    margin-top: 16px;
  }

  .stats {
    gap: 10px;
  }

  .stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
  }

  .stat__icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .stat__icon svg {
    width: 20px;
    height: 20px;
  }

  .stat b {
    font-size: 19px;
  }

  .delta {
    display: flex;
    margin: 2px 0 0;
  }

  .cols,
  .stack,
  .tiles,
  .settings {
    gap: 12px;
  }

  .cols {
    margin-top: 12px;
  }

  .panel {
    padding: 16px;
  }

  .big {
    font-size: 26px;
  }

  /* таблицы превращаются в карточки: строка - карточка, ячейка - «название: значение» */
  .table-wrap {
    margin: 0;
    overflow: visible;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr {
    display: block;
  }

  tr {
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }

  tbody tr:first-child {
    padding-top: 0;
    border-top: 0;
  }

  tbody tr:last-child {
    padding-bottom: 0;
  }

  td,
  td:first-child,
  td:last-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 32px;
    padding: 2px 0;
    border: 0;
    text-align: right;
    white-space: normal;
  }

  td[data-th]::before {
    content: attr(data-th);
    flex: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
  }

  td:first-child {
    font-weight: 700;
  }

  td .thumb,
  td .meter {
    display: none;
  }

  td:not([data-th]) {
    justify-content: stretch;
    padding-top: 8px;
  }

  td:not([data-th]) .btn {
    width: 100%;
    height: 40px;
  }

  .tools {
    margin-bottom: 12px;
  }

  .tabs {
    flex-wrap: nowrap;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tab {
    flex: none;
  }

  .find {
    width: 100%;
  }

  .find input,
  .task-add input,
  .form input,
  .dialog input,
  .dialog select,
  .auth__card input {
    font-size: 16px;
  }

  .tools .btn {
    width: 100%;
  }

  .tiles {
    grid-template-columns: minmax(0, 1fr);
  }

  .donut svg {
    width: 120px;
    height: 120px;
  }

  .auth__card {
    padding: 24px 20px;
  }
}
