:root { color-scheme: dark;
  --bg: #0a0a0f; --panel: #101018; --panel2: #14141d; --line: #1d1d28; --line2: #262636;
  --text: #ececf1; --muted: #9a9ab0; --dim: #8585a0; --soft: #c9c9d6;
  --accent: #6366f1; --accent2: #38bdf8; --accent-ink: #a5b4fc; --accent-bg: #23234a;
  --green: #34d399; --green-ink: #6ee7b7; --green-bg: #11291f;
  --red: #f87171; --red-ink: #fca5a5; --red-bg: #2a1419; --red-line: #5b2a33;
  --amber: #fbbf24; --amber-ink: #fcd34d; --amber-bg: #2a2112;
  --grad: linear-gradient(90deg, #6366f1, #38bdf8);
  --r: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: #c7d2fe; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 28px; font-weight: 800; }
h2 { margin: 0; font-size: 17px; font-weight: 800; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .soft { color: var(--soft); }
.green { color: var(--green-ink); } .red { color: var(--red-ink); } .amber { color: var(--amber-ink); }
.b { font-weight: 800; } .nowrap { white-space: nowrap; } .right { text-align: right; } .small { font-size: 13px; } .tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* каркас */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 260px; padding: 24px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.logo { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.logo i { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #6366f1, #38bdf8); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 15px; color: #fff; }
.nav { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; color: #a1a1b5; font-weight: 600; }
.nav:hover { color: #fff; background: #15151f; }
.nav.on { background: #1a1a2e; color: #fff; }
.nav.off { opacity: .45; pointer-events: none; }
.nav .soon { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #1d1d28; color: var(--dim); }
.who { padding: 18px 8px 8px; }
.who b { display: block; font-size: 15px; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.sub { font-size: 15px; color: var(--muted); margin-top: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 320px; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span2 { grid-column: auto; } .main { padding: 20px 16px 40px; } .side { max-width: none; flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; } .who { display: none; } }
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .g4.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .timer { font-size: 40px; } }
@media (max-width: 900px) { .col-side.first-mobile { order: -1; max-width: none; } }

/* карточки */
.card { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.hero { border-color: #2a2a55; background: linear-gradient(180deg, #15152e, #0f0f16); }
.card.alert { border-color: var(--red-line); }
.card.tight { padding: 16px 18px; gap: 6px; border-radius: 16px; }
.kpi .v { font-size: 26px; font-weight: 800; }
.kpi .l { font-size: 14px; color: var(--muted); font-weight: 600; }
.big { font-size: 40px; font-weight: 800; line-height: 1; }
.line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.line > span:first-child { color: #a1a1b5; }
.sep { border-top: 1px solid #22222e; padding-top: 12px; }
.box { border-radius: 14px; background: var(--panel2); padding: 14px 16px; }
.empty { border: 1px dashed #2a2a3a; border-radius: 14px; padding: 22px 16px; text-align: center; color: var(--dim); font-size: 14px; }

/* кнопки и поля */
.btn { height: 44px; padding: 0 18px; border: 1px solid var(--line2); border-radius: 12px; background: var(--panel); color: var(--soft); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: #3a3a52; color: #fff; }
.btn.primary { border: 0; background: var(--grad); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--red-line); background: var(--red-bg); color: var(--red-ink); }
.btn.ghost { border-color: transparent; background: #1c1c33; color: var(--accent-ink); height: 36px; padding: 0 12px; font-size: 14px; }
.btn.lg { height: 52px; font-size: 16px; border-radius: 14px; }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.icon-btn { width: 36px; height: 36px; padding: 0; }
.seg { display: inline-flex; gap: 4px; padding: 5px; border-radius: 14px; background: #13131c; border: 1px solid var(--line2); flex-wrap: wrap; }
.seg button { height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: #a1a1b5; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--grad); color: #fff; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 700; min-width: 0; }
.input, select.input, textarea.input { height: 44px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); color: var(--text); font-weight: 600; font-size: 15px; outline: none; width: 100%; }
textarea.input { height: auto; padding: 10px 12px; }
.input:focus { border-color: var(--accent); }
.form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.err { color: var(--red-ink); font-size: 14px; }

/* таблицы */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--dim); font-size: 12px; font-weight: 700; padding: 8px; white-space: nowrap; }
.tbl td { padding: 11px 8px; border-top: 1px solid #1a1a24; vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #13131d; }
.tbl tr.sel td { background: #17172c; }
.tbl tr.bad td { background: #1a1013; }

/* бейджи */
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #1d1d28; color: var(--muted); }
.tag.green { background: var(--green-bg); color: var(--green-ink); }
.tag.red { background: #2e1519; color: var(--red-ink); }
.tag.amber { background: var(--amber-bg); color: var(--amber-ink); }
.tag.blue { background: #1c1c3a; color: var(--accent-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--green); }

/* сделки */
.deal { border: 1px solid var(--line); border-radius: 16px; background: var(--panel2); padding: 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: left; color: var(--text); }
.deal:hover { border-color: #34344f; }
.deal.sel { border-color: var(--accent); background: #15152b; }
.deal.done { border-color: #1d3b30; }
.bar { height: 6px; border-radius: 999px; background: #22222e; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.bar.done i { background: var(--green); }
.deals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

/* таймер */
.timer { font-size: 52px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* модальное окно */
.overlay { position: fixed; inset: 0; background: rgba(5, 5, 10, .72); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; border: 1px solid #2a2a55; border-radius: 20px; background: #111119; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* уведомления */
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; max-width: 380px; padding: 14px 18px; border-radius: 14px; background: #22222e; border: 1px solid #34344f; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); font-weight: 600; }
.toast.error { border-color: var(--red-line); background: #241216; color: #fecaca; }
.toast.ok { border-color: #1d3b30; background: #0f1d17; color: #bbf7d0; }

/* вход */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; padding: 32px; gap: 18px; }
.qr { width: 200px; height: 200px; border-radius: 12px; background: #fff; padding: 8px; align-self: center; }
.code-input { font-size: 28px; letter-spacing: .4em; text-align: center; height: 60px; font-variant-numeric: tabular-nums; }
.demo-badge { position: fixed; right: 16px; top: 12px; z-index: 40; padding: 6px 12px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-ink); font-size: 12px; font-weight: 800; }

/* графики */
.bars { height: 220px; display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid #22222e; padding: 0 4px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 40px; border-radius: 8px 8px 0 0; background: #4f46e5; }
.bars .b span { font-size: 11px; color: var(--soft); font-weight: 700; }
.bars-x { display: flex; gap: 10px; padding: 0 4px; font-size: 11px; color: var(--muted); }
.bars-x span { flex: 1; text-align: center; min-width: 0; overflow: hidden; }

/* расписание */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: 12px; font-weight: 700; color: var(--dim); padding: 0 4px 2px; }
.cal-blank { min-height: 1px; }
.cal-cell { border: 1px solid var(--line); background: var(--panel2); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-cell.today { border-color: var(--accent); background: #15152b; }
.cal-cell.past { opacity: .82; }
.cal-n { font-size: 13px; font-weight: 800; color: var(--soft); display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; }
.cal-cell.today .cal-n { color: var(--accent-ink); }
.cal-dw { display: none; font-size: 11px; font-weight: 600; color: var(--dim); }
.slot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; width: 100%; min-height: 30px; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; font-size: 12px; font-weight: 700; text-align: left; line-height: 1.2; cursor: default; }
.slot.edit { cursor: pointer; }
.slot.edit:hover { border-color: #4b4b6e; }
.slot:disabled { opacity: 1; }
.slot.none { border: 1px dashed #5b2a33; }
.slot.gone { border: 1px dashed #24242f; }
.slot.me { box-shadow: inset 0 0 0 2px var(--accent); }
.slot-k { opacity: .7; font-size: 11px; }
.slot-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.slot-mark { font-size: 10px; font-weight: 800; white-space: nowrap; }
.slot-mark.green { color: var(--green); } .slot-mark.amber { color: var(--amber); } .slot-mark.red { color: #ff8a8a; } .slot-mark.soft { color: var(--soft); font-weight: 600; }
.brush { height: 36px; padding: 0 14px; border: 2px solid transparent; border-radius: 10px; font-weight: 700; cursor: pointer; }
.brush.on { border-color: #fff; }
.brush.clear { background: var(--red-bg); color: var(--red-ink); }
@media (max-width: 760px) {
  .cal { grid-template-columns: minmax(0, 1fr); }
  .cal-dow, .cal-blank { display: none; }
  .cal-cell { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .cal-n { width: 100%; justify-content: flex-start; gap: 8px; }
  .cal-dw { display: inline; }
  .cal-cell .slot { flex: 1 1 140px; width: auto; }
}

/* ЗП и деньги */
.tbl tr.total td { border-top: 1px solid var(--line2); font-weight: 800; }
.tbl tr.sub td { background: #0e0e15; font-size: 13px; }
.tiers { display: flex; flex-direction: column; gap: 8px; }
.tier-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; gap: 8px; align-items: end; }

.tbl td.num, .tbl td.nowrap { white-space: nowrap; }
.stack-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }

/* бухгалтерия: таблица по дням */
.books-wrap { margin: 0 -6px; }
table.books { min-width: 1100px; font-size: 13px; }
.books th, .books td { padding: 8px 6px; white-space: nowrap; }
.books .sticky { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 150px; }
.books .today { background: #15152b; }
.books tr.strong td { border-top: 1px solid #2a2a3a; font-weight: 800; }
.books tr.group td { padding-top: 16px; }
.tbl tr.strong td { font-weight: 800; }
@media (max-width: 560px) { .books .sticky { min-width: 110px; } }

/* компактные списки на дашборде */
.card.compact { padding: 18px; gap: 10px; }
.mini-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 9px 12px; border-radius: 12px; background: var(--panel2); }
.mini-row:hover { background: #181824; }
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty.slim { padding: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; }
/* по часам */
.hours { height: 130px; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid #22222e; }
.hours .hb { flex: 1; display: flex; align-items: flex-end; height: 100%; min-width: 0; }
.hours .hb i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: #4f46e5; }
.hours-x { display: flex; gap: 4px; font-size: 11px; color: var(--muted); }
.hours-x span { flex: 1; min-width: 0; }
@media (max-width: 560px) { .mini-row b.small[style] { width: auto !important; } .mini-row .ellipsis { white-space: normal; } }

/* расписание: имена не вылезают за ячейку */
.slot { overflow: hidden; min-width: 0; }
.slot-fact { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* чекбоксы настроек */
.check-row { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--soft); cursor: pointer; padding: 4px 0; }
.check-row input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }

/* ---------- дашборд: шапка с периодом, выбор команды, график + рейтинг ---------- */
.dash-head { align-items: flex-start; }
.dash-ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: auto; }
.dash-ctl .r1 { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dash-ctl .r2 { display: flex; gap: 8px; align-items: center; justify-content: flex-end; min-height: 50px; }
.dash-ctl .r2 .note { color: var(--muted); font-size: 13px; font-weight: 600; padding: 0 6px; }
.dash-ctl .r2 .input { height: 50px; width: auto; }
select.pick { -webkit-appearance: none; appearance: none; height: 50px; padding: 0 44px 0 16px; border: 1px solid var(--line2); border-radius: 14px; background-color: #13131c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1b5' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; color: var(--text); font-weight: 600; cursor: pointer; line-height: 48px; }
select.pick:focus { border-color: var(--accent); outline: none; }
.duo > .card { height: 400px; }
.duo .rating { overflow-y: auto; flex: 1; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.duo .rating th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
@media (max-width: 900px) {
  .dash-ctl { align-items: flex-start; margin-left: 0; width: 100%; }
  .dash-ctl .r1, .dash-ctl .r2 { justify-content: flex-start; }
  .duo > .card { height: auto; }
  .duo .rating { max-height: 360px; }
}
.dash-ctl.inline { flex-direction: row; align-items: center; flex-wrap: wrap; margin-left: 0; }
.dash-ctl.inline .r1, .dash-ctl.inline .r2 { justify-content: flex-start; }
.tag.sla { white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; padding: 3px 9px; font-size: 11px; }
.tbl tr.warn-row td { background: rgba(239, 68, 68, 0.07); }
.files { display: grid; gap: 8px; }
.file { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line, #2a2a33); background: transparent; color: inherit; cursor: pointer; font: inherit; }
.file:hover { background: rgba(255, 255, 255, 0.04); }
.file.bad { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.06); }
.file-ic { flex: none; width: 38px; height: 44px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(239, 68, 68, 0.15); color: #F87171; }
.file-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-ic.img { background: rgba(99, 102, 241, 0.18); color: #A5B4FC; }
.drop { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; text-align: center; padding: 22px 16px; border: 1.5px dashed var(--line2); border-radius: 14px; cursor: pointer; }
.drop:hover, .drop:focus { border-color: #6366F1; outline: none; }
.drop.has { border-style: solid; border-color: rgba(52, 211, 153, 0.5); }
.file-row { display: flex; gap: 8px; align-items: stretch; }
.file-row .file { flex: 1; min-width: 0; }
.file-del { flex: none; width: 44px; padding: 0; color: var(--red-ink); }
.file.gone { opacity: 0.45; text-decoration: line-through; }
