/* EREMIN — тёмная тема в цветах бренда: чёрный / белый / hot pink. */
:root {
  --bg: #0c0c0e;
  --panel: #17171b;
  --panel-2: #1f1f24;
  --line: #2b2b32;
  --text: #f4f4f6;
  --muted: #9b9ba5;
  --pink: #ec1e6e;
  --pink-dk: #c4145a;
  --pink-soft: rgba(236,30,110,.14);
  --ok: #3ddc84;
  --err: #ff5c5c;
  --warn: #ffb648;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main {
  max-width: 1100px; margin: 0 auto;
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
}
h1 { font-size: 22px; margin: 6px 0 16px; font-weight: 800; letter-spacing: .2px; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; }
h3 { font-size: 15px; margin: 16px 0 8px; }
a { color: var(--pink); text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.ok-t { color: var(--ok); font-weight: 600; }
.err-t { color: var(--err); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }

/* ---------- логотип ---------- */
.logo {
  display: inline-block; font-weight: 900; font-size: 17px; letter-spacing: 2px;
  color: #fff; border: 2px solid #fff; border-radius: 8px; padding: 3px 12px;
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}
.logo .e { color: var(--pink); }
.logo:hover { text-decoration: none; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  background: rgba(12,12,14,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.desktop-nav { display: flex; gap: 4px; }
.desktop-nav a { color: var(--muted); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.desktop-nav a.on { color: #fff; background: var(--pink-soft); }
.desktop-nav a:hover { color: #fff; }
.who { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); }
.who .exit { color: var(--pink); font-weight: 700; }

/* ---------- нижняя навигация (мобильная) ---------- */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(18,18,22,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; border-radius: 12px;
}
.bottom-nav a .ic { font-size: 20px; line-height: 1; filter: grayscale(1) brightness(1.4); }
.bottom-nav a.on { color: var(--pink); }
.bottom-nav a.on .ic { filter: none; }

/* ---------- flash ---------- */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.flash.ok { background: rgba(61,220,132,.12); color: var(--ok); }
.flash.error { background: rgba(255,92,92,.12); color: var(--err); }

/* ---------- панели / карточки ---------- */
.panel, .form-card, .card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.client-card { display: block; color: inherit; transition: transform .12s, border-color .12s; }
.client-card:active { transform: scale(.98); }
.client-card:hover { text-decoration: none; border-color: var(--pink); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cid {
  font-weight: 900; font-size: 11px; letter-spacing: 1.2px;
  border: 1.5px solid #fff; border-radius: 6px; padding: 2px 8px; color: #fff;
}
.cid.big { font-size: 13px; vertical-align: middle; margin-right: 6px; }
.badge { font-size: 12px; padding: 3px 12px; border-radius: 999px; background: var(--pink-soft); color: var(--pink); font-weight: 700; white-space: nowrap; }
.cname { font-size: 18px; font-weight: 800; margin: 10px 0 2px; }
.card-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13.5px; }

/* фирменный элемент: сегментный прогресс курса */
.progress { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 12px; }
.progress i { width: 10px; height: 18px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--line); }
.progress i.used { background: var(--pink); border-color: var(--pink-dk); box-shadow: 0 0 6px rgba(236,30,110,.5); }
.progress.lg i { width: 14px; height: 24px; }

/* ---------- формы ---------- */
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 12px 14px;
  font: inherit; font-size: 16px; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
  min-height: 48px;
}
textarea { min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pink); outline-offset: 0; border-color: var(--pink); }
input[type="date"], select { appearance: none; -webkit-appearance: none; }
input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; accent-color: var(--pink); }
fieldset { border: 1px dashed var(--line); border-radius: 12px; margin: 12px 0; padding: 12px; }
legend { font-weight: 700; font-size: 12px; padding: 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid4-form { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 10px; align-items: end; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.check input { width: 20px; margin: 0; }
.lbl { font-weight: 600; font-size: 13px; color: var(--muted); }
.zone-checks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.zone-checks .check {
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px;
  background: var(--panel-2); min-height: 44px;
}
.zone-checks .check:has(input:checked) { border-color: var(--pink); background: var(--pink-soft); color: var(--pink); }
.actions { display: flex; gap: 10px; margin-top: 8px; }
.status-form select, .status-form textarea { margin-bottom: 10px; }
.inline { display: inline; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn:hover { border-color: var(--pink); color: var(--pink); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn.primary:hover { background: var(--pink-dk); color: #fff; }
.btn.wide { width: 100%; }
.btn.tiny { min-height: 38px; padding: 6px 12px; font-size: 13px; }
.btn.micro { min-height: 34px; padding: 4px 10px; font-size: 13px; border-radius: 9px; }
.btn.ok { color: var(--ok); } .btn.err { color: var(--err); }
.tiny-inp { width: 140px; padding: 8px 10px; margin: 0; display: inline-block; min-height: 38px; font-size: 14px; }
.row-actions form { display: inline; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- таблицы ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid-table td { min-width: 132px; }
.grid-table .tcell { font-weight: 800; min-width: 62px; color: var(--muted); }
.grid-table td.full { background: rgba(255,182,72,.08); }
.slot { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 3px 0; font-size: 13.5px; }
.slot a { color: var(--text); font-weight: 600; }
.slot.done { border-color: rgba(61,220,132,.4); background: rgba(61,220,132,.08); }
.slot.missed { border-color: rgba(255,92,92,.4); background: rgba(255,92,92,.08); text-decoration: line-through; }

/* ---------- сводка ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 12px; text-align: center; position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--pink); }
.stat b { display: block; font-size: 26px; font-weight: 900; color: #fff; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- статусы / таймлайн ---------- */
.timeline { list-style: none; padding: 0; margin: 14px 0 0; }
.timeline li { padding: 10px 0 10px 14px; border-left: 3px solid var(--pink); margin-bottom: 8px; }
.tl-comment { background: var(--panel-2); border-radius: 10px; padding: 8px 12px; margin-top: 6px; font-size: 14px; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; margin: 0; font-size: 14.5px; }
dt { color: var(--muted); } dd { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.empty { color: var(--muted); padding: 18px; text-align: center; }

/* ---------- вход ---------- */
.login-wrap { min-height: 85vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 30px 26px; width: 350px; }
.login-brand { font-size: 28px; font-weight: 900; letter-spacing: 3px; border: 3px solid #fff; border-radius: 10px; display: inline-block; padding: 4px 16px; margin-bottom: 4px; }
.login-brand span { color: var(--pink); }
.day-nav { display: flex; gap: 8px; align-items: center; }
.day-nav input { margin-top: 0; }

/* ---------- мобильные ---------- */
@media (max-width: 820px) {
  .desktop-nav { display: none; }
  .bottom-nav { display: flex; }
  .who-name { display: none; }
  .two-col, .grid3, .grid4, .grid4-form { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 20px; }
  dl { grid-template-columns: 120px 1fr; }

  /* таблицы данных превращаются в карточки */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr {
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
    margin-bottom: 10px; padding: 10px 12px;
  }
  table.stack td { border: none; padding: 4px 0; min-width: 0; }
  table.stack td[data-l]::before {
    content: attr(data-l); display: inline-block; width: 110px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  }
}
@media (max-width: 520px) {
  .grid3, .grid4, .grid4-form, .two-col { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .page-head .btn { width: 100%; }
  main { padding-left: 12px; padding-right: 12px; }
}

/* ---------- поиск ---------- */
.search-wrap { margin-bottom: 14px; }
.search-wrap input {
  margin-top: 0; border-radius: 14px; background: var(--panel);
  font-size: 16px; padding: 13px 16px;
}
.slot.dim { opacity: .25; }
.slot.hit { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink); }

/* ---------- skeleton-загрузка ---------- */
#skeleton { max-width: 1100px; margin: 0 auto; padding: 16px; }
.sk {
  display: block; border-radius: 10px;
  background: linear-gradient(100deg, var(--panel) 40%, var(--panel-2) 50%, var(--panel) 60%);
  background-size: 200% 100%;
  animation: sk-shine 1.1s linear infinite;
}
@keyframes sk-shine { to { background-position: -200% 0; } }
.sk-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sk-title { width: 180px; height: 28px; }
.sk-btn { width: 130px; height: 44px; border-radius: 12px; }
.sk-line { height: 16px; margin-bottom: 12px; }
.w90 { width: 90%; } .w75 { width: 75%; } .w60 { width: 60%; } .w40 { width: 40%; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-bottom: 16px; }
.sk-card { height: 150px; border-radius: var(--radius); }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
@media (max-width: 520px) { .sk-grid { grid-template-columns: 1fr; } }

/* ---------- v2: тосты ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; z-index: 50;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 20px; border-radius: 14px; font-weight: 700; font-size: 14px;
  transition: all .25s; box-shadow: 0 8px 30px rgba(0,0,0,.5); pointer-events: none;
  max-width: 90vw;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.ok { border-color: rgba(61,220,132,.5); }
.toast.error { border-color: rgba(255,92,92,.5); }

/* ---------- v2: мой день ---------- */
.big-badge { font-size: 14px; padding: 8px 16px; }
.day-list { display: flex; flex-direction: column; gap: 10px; }
.day-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  transition: border-color .2s, opacity .2s;
}
.day-item.v-done { border-color: rgba(61,220,132,.5); }
.day-item.v-done .day-time { color: var(--ok); }
.day-item.v-missed { border-color: rgba(255,92,92,.4); opacity: .65; }
.day-item.v-missed .day-name { text-decoration: line-through; }
.day-time { font-size: 17px; font-weight: 900; min-width: 56px; }
.day-info { flex: 1; min-width: 0; }
.day-name { color: var(--text); font-weight: 700; }
.day-actions { display: flex; gap: 6px; }
.mt { margin-top: 12px; }

/* ---------- v2: фильтры ---------- */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 12px 14px; }
.filter-bar label { margin: 0; }
.client-card.archived { opacity: .55; }

/* ---------- v2: графики ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-stack { display: flex; flex-direction: column-reverse; justify-content: flex-start; height: 124px; width: 100%; max-width: 40px; }
.bar { display: block; width: 100%; background: var(--pink); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.missed { background: var(--warn); border-radius: 0; }
.bar-label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.legend { font-size: 11px; text-transform: none; letter-spacing: 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.legend .lg-done { background: var(--pink); } .legend .lg-missed { background: var(--warn); }
.stat em { display: block; font-style: normal; font-size: 11px; margin-top: 3px; }

/* воронка */
.funnel-row { display: grid; grid-template-columns: 130px 1fr 36px; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.funnel-name { color: var(--muted); font-size: 12.5px; }
.funnel-bar { background: var(--panel-2); border-radius: 6px; height: 20px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; background: var(--pink); border-radius: 6px; min-width: 2px; }

/* тепловая карта */
.heat { border-collapse: separate; border-spacing: 3px; }
.heat th, .heat td { border: none; padding: 0; font-size: 11px; text-align: center; }
.heat th { color: var(--muted); }
.heat .tcell { text-align: left; padding-right: 8px; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.heat-cell { width: 34px; height: 30px; border-radius: 6px; background: var(--panel-2); color: #fff; font-weight: 700; }
.heat-1 { background: rgba(236,30,110,.25); }
.heat-2 { background: rgba(236,30,110,.45); }
.heat-3 { background: rgba(236,30,110,.65); }
.heat-4 { background: rgba(236,30,110,.85); }
.heat-5 { background: var(--pink); }

/* ---------- v2: разное ---------- */
.form-card.narrow { max-width: 420px; }
.secret { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; margin: 3px; font-size: 15px; letter-spacing: 1px; user-select: all; }
.codes { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.err-code { font-size: 56px; font-weight: 900; color: var(--pink); }
.center { text-align: center; }
.quick-book summary { list-style: none; cursor: pointer; display: inline-flex; }
.quick-book summary::-webkit-details-marker { display: none; }
.who-name { color: var(--muted); }
.who-name:hover { color: #fff; text-decoration: none; }
tr.v-missed td { opacity: .6; }
