/* FORMULA ЖИЛЬЯ CRM — бордо және ақ */
:root {
  --brand: #7a1f33;
  --brand-600: #66192a;
  --brand-700: #521321;
  --brand-50: #faf2f4;
  --brand-100: #f3e1e5;
  --ink: #1f1a1c;
  --ink-2: #4a4246;
  --muted: #8a8185;
  --line: #ece7e5;
  --line-2: #f3efed;
  --bg: #f7f5f3;
  --panel: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e7f4ec;
  --warn: #b25e09;
  --warn-bg: #fdf0e1;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 26, 28, .04), 0 4px 16px rgba(31, 26, 28, .04);
  --sidebar: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; margin: 18px 0 10px; color: var(--ink-2); }
p { margin: 0 0 10px; }
code { font-size: 13px; background: var(--line-2); padding: 1px 6px; border-radius: 6px; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.block { display: block; }
.hidden { display: none !important; }
.pre { white-space: pre-wrap; word-break: break-word; }
.text-bad { color: var(--bad); font-weight: 600; }
.mt { margin-top: 8px; }
.pad { padding: 14px 20px; }

/* ---------- Каркас ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--brand-700);
  background: linear-gradient(180deg, #5a1626 0%, #3f0f1b 100%);
  color: #fff; display: flex; flex-direction: column; z-index: 40; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 6px 8px 22px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--brand);
  display: grid; place-items: center; font: 700 22px/1 var(--serif);
}
.brand-mark.lg { width: 52px; height: 52px; font-size: 30px; border-radius: 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 15px; letter-spacing: .16em; }
.brand-text span { font-size: 11px; letter-spacing: .32em; opacity: .7; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255, 255, 255, .78); font-weight: 500; position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-link.active { background: #fff; color: var(--brand); }
.nav-link .pill { margin-left: auto; font-style: normal; background: #fff; color: var(--brand); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav-link.active .pill { background: var(--brand); color: #fff; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .12); }
.sidebar-user .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar-user .who b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: 12px; opacity: .65; }
.sidebar-user form { margin: 0; }
.sidebar-user .icon-btn { color: rgba(255, 255, 255, .75); }
.sidebar-user .avatar { background: rgba(255, 255, 255, .14); color: #fff; }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: rgba(247, 245, 243, .88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.quick-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; color: var(--muted); }
.quick-search input { border: 0; outline: 0; background: transparent; padding: 10px 0; width: 100%; font: inherit; color: var(--ink); }
.quick-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.topbar .bell { margin-left: auto; position: relative; }
.bell em { position: absolute; top: 2px; right: 0; background: var(--bad); color: #fff; font: 700 10px/16px var(--font); min-width: 16px; padding: 0 4px; border-radius: 99px; text-align: center; font-style: normal; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 64px; max-width: 1440px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.scrim { display: none; }
.fab { display: none; }

/* ---------- Кнопкалар және формалар ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: 600 14px/1 var(--font); padding: 10px 16px; border-radius: 10px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; border-color: #d9d1ce; background: #fcfbfa; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--brand-100); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-50); border-color: transparent; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: rgba(0, 0, 0, .05); }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #e3dcd9; border-radius: 10px;
  padding: 10px 12px; width: 100%; min-height: 42px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a8185' stroke-width='1.8'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
fieldset.field > span { margin-bottom: 2px; }
.field-error { color: var(--bad); font-size: 12.5px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-5 { grid-template-columns: 1.4fr 1fr 1fr 1.2fr auto; align-items: end; }
.form-grid.cols-5 .field { margin-bottom: 0; }
.span-2 { grid-column: span 2; }
.form-card { max-width: 860px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.form-meta { display: flex; align-items: center; gap: 6px; padding: 12px 0 16px; border-top: 1px dashed var(--line); margin-top: 4px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 9px 14px; border: 1px solid #e3dcd9; border-radius: 99px; cursor: pointer; font-weight: 500; font-size: 14px; background: #fff; transition: all .15s; user-select: none; }
.chip span:hover { border-color: var(--brand); }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-100); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 40px; height: 24px; border-radius: 99px; background: #ddd4d1; position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
.booking { padding: 14px; border-radius: var(--radius-sm); background: var(--brand-50); margin-bottom: 14px; }
.booking .field { margin: 12px 0 0; max-width: 320px; }

/* ---------- Карточкалар ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .ic { color: var(--brand); }
.card-head form { margin: 0; }
.card.attention { border-color: #ecc5cd; background: linear-gradient(0deg, #fff, var(--brand-50)); }
.table-card { padding: 0; overflow: hidden; }
.table-card > .card-head { padding: 18px 20px 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line); }
.stat.accent::before { background: var(--brand); }
.stat.ok::before { background: var(--ok); }
.stat.warn::before { background: var(--warn); }
.stat.muted::before { background: #c9c1bd; }
.stat-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat.accent .stat-value { color: var(--brand); }
.stat-hint { font-size: 12px; color: var(--muted); }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #c6e6d3; }
.flash.error { background: var(--bad-bg); color: var(--bad); border-color: #f5c9c4; }

.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #f1edeb; color: var(--ink-2); }
.badge.brand { background: var(--brand-100); color: var(--brand); }
.badge.blue { background: #e8effd; color: #2450a6; }
.badge.violet { background: #efeafc; color: #5b3aa8; }
.badge.teal { background: #e3f5f3; color: #0f6e66; }
.badge.green { background: var(--ok-bg); color: var(--ok); }
.badge.orange { background: var(--warn-bg); color: var(--warn); }
.badge.amber { background: #fdf5dc; color: #8a6200; }
.badge.red { background: var(--bad-bg); color: var(--bad); }
.badge.gray { background: #f1edeb; color: #6d6468; }
.badge.dark { background: var(--ink); color: #fff; }
.badge.outline { background: transparent; border: 1px solid var(--brand-100); color: var(--brand); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--brand-50); color: var(--brand); vertical-align: middle; }
.tag.gold { background: #fdf3d6; color: #8a6200; }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

/* ---------- Тізімдер ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; }
.list li > a, .list li > .grow, .list li.row-actions { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: inherit; }
.list li > a:hover { text-decoration: none; background: var(--brand-50); margin: 0 -10px; padding: 10px; border-radius: 10px; }
.list li { display: flex; align-items: center; gap: 10px; }
.list li > a { flex: 1; min-width: 0; }
.list .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list .grow b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.list .grow small { color: var(--muted); font-size: 13px; }
.list .time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; display: flex; flex-direction: column; color: var(--brand); }
.list .time small { font-weight: 500; color: var(--muted); font-size: 11px; }
.list li.overdue .time { color: var(--bad); }
.list li.future .time { color: var(--ink-2); }
.list li.done { opacity: .55; }
.list form { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.list li.row-actions { flex-wrap: wrap; }
.list li.row-actions > .grow { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; }
.quote { display: block; color: var(--ink-2); font-style: italic; }
.empty-sm { color: var(--muted); font-size: 14px; padding: 6px 0; margin: 0; }
.empty { text-align: center; padding: 48px 20px; }
.empty h2 { margin-bottom: 8px; font-size: 20px; }
.empty .btn { margin-top: 10px; }

.bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.bars a { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 10px; color: inherit; padding: 4px 6px; border-radius: 8px; font-size: 13.5px; }
.bars a:hover { background: var(--brand-50); text-decoration: none; }
.bar-track { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 99px; min-width: 2px; }
.bars b { text-align: right; font-variant-numeric: tabular-nums; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

/* ---------- Кестелер ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fcfbfa; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: #fcfbfa; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.card:not(.table-card) .table th { background: transparent; }
.card:not(.table-card) .table td:first-child, .card:not(.table-card) .table th:first-child { padding-left: 0; }
.card:not(.table-card) .table td:last-child, .card:not(.table-card) .table th:last-child { padding-right: 0; }
.clients-table tbody tr { cursor: pointer; transition: background .1s; }
.clients-table tbody tr:hover { background: var(--brand-50); }
.cell-main a { color: var(--ink); display: flex; flex-direction: column; }
.cell-main a:hover { text-decoration: none; color: var(--brand); }
.cell-main small { color: var(--muted); font-variant-numeric: tabular-nums; }
tr.inactive { opacity: .5; }
tr.sel td { background: var(--brand-50); font-weight: 600; }
.rank { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line-2); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.rank.top { background: var(--brand); color: #fff; }
.edit-row td { background: var(--brand-50); }
.scroll-x { overflow-x: auto; margin-bottom: 12px; }
.table.raw td, .table.raw th { white-space: nowrap; }

/* ---------- Сүзгілер, кезеңдер ---------- */
.filters { padding: 14px; }
.filter-main { display: flex; gap: 8px; }
.search-input { flex: 1; display: flex; align-items: center; gap: 8px; border: 1px solid #e3dcd9; border-radius: 10px; padding: 0 12px; color: var(--muted); background: #fff; }
.search-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.search-input input { border: 0; box-shadow: none !important; padding: 10px 0; }
.toggle-filters.on { border-color: var(--brand); color: var(--brand); }
.filter-more { display: none; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.filter-more.open { display: flex; }
.filter-more select { width: auto; min-width: 160px; }
.filter-more .inline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.filter-more .inline input { width: auto; }
.result-count { margin: -6px 0 10px 4px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }

.period { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 7px 14px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.seg a:hover { text-decoration: none; background: var(--line-2); }
.seg a.on { background: var(--brand); color: #fff; }
.custom-range { display: flex; align-items: center; gap: 6px; }
.custom-range input { width: auto; min-height: 36px; padding: 6px 10px; font-size: 13.5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; }
.steps li { padding: 6px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--muted); }
.steps li.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.steps li.past { color: var(--ok); }

/* ---------- Іздеу блоктары ---------- */
.search-hero { margin-bottom: 18px; }
.big-search { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow); color: var(--muted); }
.big-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }
.big-search input { border: 0; box-shadow: none !important; font-size: 17px; padding: 10px 0; }
.cta-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; margin-bottom: 18px; }
.cta { display: flex; align-items: center; gap: 14px; background: var(--brand); color: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: 0 8px 24px rgba(122, 31, 51, .25); }
.cta:hover { text-decoration: none; background: var(--brand-600); }
.cta span { display: flex; flex-direction: column; }
.cta b { font-size: 17px; }
.cta small { opacity: .8; }

/* ---------- Клиент карточкасы ---------- */
.client-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.client-id { display: flex; gap: 16px; align-items: center; }
.phone-link { display: inline-flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.phone-link .ic { color: var(--brand); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.assigned { display: flex; flex-direction: column; text-align: right; }
.assigned b { font-size: 16px; }
.client-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.info div { min-width: 0; }
.info .wide { grid-column: span 2; }
.info dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.info dd { margin: 0; font-weight: 500; }
.edit-form { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.decision { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 20px; }
.decision .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.seg-form { display: flex; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.opt { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border: 1px solid #e3dcd9; border-radius: 10px; background: #fff; font: 600 14px var(--font); cursor: pointer; color: var(--ink); }
.opt:hover { border-color: var(--brand); }
.opt.on.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.on.bad { background: #6d6468; border-color: #6d6468; color: #fff; }
.opt-radio input { position: absolute; opacity: 0; }
.opt-radio input:checked + .opt { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt-radio input:focus-visible + .opt { box-shadow: 0 0 0 3px var(--brand-100); }
.status-form { display: flex; flex-direction: column; gap: 10px; }
.pipeline { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 0; }
.pipeline li { position: relative; padding: 5px 0 5px 22px; font-size: 13px; color: var(--muted); }
.pipeline li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #d9d1ce; background: #fff; }
.pipeline li::after { content: ""; position: absolute; left: 8px; top: 21px; bottom: -6px; width: 1px; background: #e3dcd9; }
.pipeline li:last-child::after { display: none; }
.pipeline li.past { color: var(--ink-2); }
.pipeline li.past::before { background: var(--brand); border-color: var(--brand); }
.pipeline li.cur { color: var(--brand); font-weight: 700; }
.pipeline li.cur::before { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.meet-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.meet-form .field { margin: 0; }
.comment-form { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.comment-form textarea { min-height: 46px; }
.comments { list-style: none; margin: 0; padding: 0; }
.comments li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.comments li > div { min-width: 0; flex: 1; }
.comments .meta { margin-bottom: 3px; }
.comments p { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid #cfc6c3; }
.timeline li.t-status::before, .timeline li.t-created::before { border-color: var(--brand); }
.timeline li.t-assign::before, .timeline li.t-transfer::before { border-color: #5b3aa8; }
.timeline li.t-quality::before, .timeline li.t-visit::before { border-color: var(--ok); }
.t-text { font-weight: 600; font-size: 13.5px; }
.t-note { font-size: 13px; color: var(--ink-2); }
.t-meta { font-size: 12px; color: var(--muted); }
.dup-alert { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--warn-bg); border: 1px solid #f3d4ad; color: #7a4208; margin-bottom: 16px; }
.dup-alert p { margin: 2px 0 0; font-size: 14px; }
.dup-alert[hidden] { display: none; }
.drop { display: block; border: 2px dashed #e0d6d3; border-radius: 14px; padding: 30px; text-align: center; margin: 16px 0; cursor: pointer; background: #fcfbfa; }
.drop:hover { border-color: var(--brand); }
.drop span { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-2); }
.drop input { width: auto; margin: 0 auto 10px; border: 0; min-height: 0; }

.inline-form { display: flex; gap: 8px; max-width: 520px; margin-bottom: 8px; }
.row-form { padding: 8px 14px !important; }
.city-row { display: grid; grid-template-columns: minmax(0, 2fr) 90px 150px 110px auto; gap: 8px; align-items: center; }
.city-row .num { text-align: right; font-size: 13px; }
.warn-banner { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: 14px; background: var(--warn-bg); border: 1px solid #f3d4ad; color: #7a4208; margin-bottom: 18px; }
.warn-banner .grow { flex: 1; min-width: 0; }
.warn-banner b { display: block; font-size: 15px; margin-bottom: 2px; }
.warn-banner p { margin: 0 0 10px; }
.warn-banner form { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.warn-banner input { flex: 1; min-width: 200px; background: #fff; }
.seg-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.seg-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-weight: 600; font-size: 14px; }
.seg-tabs a:hover { text-decoration: none; border-color: #d9d1ce; }
.seg-tabs a em { font-style: normal; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); }
.seg-tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg-tabs a.on em { background: rgba(255,255,255,.2); color: #fff; }
.seg-tabs a.t-qual:not(.on) em { background: var(--ok-bg); color: var(--ok); }
.seg-tabs a.t-contract:not(.on) em { background: var(--brand-100); color: var(--brand); }
.seg-tabs a.t-brak:not(.on) em { background: var(--warn-bg); color: var(--warn); }
.nav-sub { padding-left: 42px; font-size: 14px; padding-top: 7px; padding-bottom: 7px; }
.nav-sub::before { content: ""; position: absolute; left: 21px; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }

.bell em[hidden] { display: none; }
.notif-list li.unread > a { background: var(--brand-50); margin: 0 -10px; padding: 10px; border-radius: 10px; }
.notif-list .grow b { white-space: normal; font-weight: 500; }
.notif-list li.unread .grow b { font-weight: 650; }
.notif-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--line-2); color: var(--ink-2); }
.notif-ic.t-came { background: var(--ok-bg); color: var(--ok); }
.notif-ic.t-came_again, .notif-ic.t-transfer { background: var(--warn-bg); color: var(--warn); }
.toasts { position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: #1f1a1c; color: #fff; padding: 14px 16px; border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.25); font-size: 14px; animation: toastIn .25s ease; }
.toast:hover { text-decoration: none; background: #2b2427; }
.toast .ic { color: #7fd6a5; margin-top: 1px; }
.toast small { display: block; opacity: .6; margin-top: 2px; font-size: 12px; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 860px) { .toasts { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Бүгін келетін / келмеген клиенттер ---------- */
.clients-table tr.row-today td { background: #fdecea; }
.clients-table tr.row-today td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.clients-table tr.row-today:hover td { background: #fbdcd8; }
.clients-table tr.row-came td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.clients-table tr.row-noshow td:first-child { box-shadow: inset 4px 0 0 #c9c1bd; }
.badge.today { background: var(--bad); color: #fff; }
.seg-tabs a.t-today:not(.on) em { background: var(--bad); color: #fff; }
.seg-tabs a.t-today.on { background: var(--bad); border-color: var(--bad); }
.seg-tabs a.t-noshow:not(.on) em { background: #f1edeb; color: var(--ink-2); }
.warn-banner.bad { background: var(--bad-bg); border-color: #f5c9c4; color: #8a1c13; }
.warn-banner.today { background: #fdecea; border-color: #f5c9c4; color: #8a1c13; }
.noshow-card { border-color: #f5c9c4; }
.noshow-card .card-head h2 .ic { color: var(--bad); }
.notif-ic.t-no_show { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 860px) {
  .clients-table tr.row-today { background: #fdecea; box-shadow: inset 4px 0 0 var(--bad); }
  .clients-table tr.row-today td { background: transparent; }
  .clients-table tr.row-today td:first-child, .clients-table tr.row-came td:first-child, .clients-table tr.row-noshow td:first-child { box-shadow: none; }
  .clients-table tr.row-came { box-shadow: inset 4px 0 0 var(--ok); }
}

/* ---------- Келісімшарт хабары ---------- */
.badge.gold { background: #fdf3d6; color: #8a6200; }
.stat.gold::before { background: #c9971c; }
.stat.gold .stat-value { color: #8a6200; }
.d-contract, .n-contract { background: #fdf3d6; color: #8a6200; }
.notif-ic.t-contract { background: #fdf3d6; color: #8a6200; }
.notif-ic.t-taken { background: #efeafc; color: #5b3aa8; }
.cons-name { color: var(--ink-2); font-weight: 600; }

/* ---------- Консультант ---------- */
.hint { font-size: 13px; color: var(--muted); margin: -6px 0 12px; }
.seg-sm a { padding: 5px 10px; font-size: 12.5px; }
.stale-card { border-color: #f5c9c4; }
.stale-card .card-head h2, .stale-card .card-head h2 .ic { color: var(--bad); }
.stale-note { display: flex; align-items: center; gap: 4px; color: var(--bad); font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.clients-table tr.row-stale td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.cc-info { border-left: 4px solid #5b3aa8; }
.cc-info .card-head h2 .ic { color: #5b3aa8; }
.accept-card { padding: 12px 18px; }
.accept-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.accept-line .ic { color: var(--ok); }
.accept-line.muted .ic { color: var(--muted); }
.accept-line span { flex: 1; min-width: 0; }
.accept-line time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.warn-banner.choose .choose-form { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.warn-banner.choose .btn-row .btn { white-space: normal; text-align: left; }
.notif-ic.t-opened { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 860px) { .clients-table tr.row-stale { box-shadow: inset 4px 0 0 var(--bad); } .clients-table tr.row-stale td:first-child { box-shadow: none; } }

.stats-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.stats-head h2 { font-size: 16px; }
.stats-head a { margin-left: auto; }

/* ---------- Колл-центр есебі (күнтізбе) ---------- */
.cc-top { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.cc-user .field { margin: 0; min-width: 220px; }
.cc-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { font-size: 18px; }
.cal-head .icon-btn { font-size: 22px; color: var(--brand); }
.cal-head .icon-btn:hover { text-decoration: none; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.d-entered, .n-entered { background: #ece7e5; color: var(--ink-2); }
.d-booked, .n-booked { background: #efeafc; color: #5b3aa8; }
.d-came, .n-came { background: var(--ok-bg); color: var(--ok); }
.cal { display: flex; flex-direction: column; gap: 4px; }
.cal-row { display: grid; grid-template-columns: 44px repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 4px 0; }
.wk { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; color: var(--muted); font-weight: 700; font-size: 13px; line-height: 1.1; border: 1px dashed transparent; }
.wk small { font-size: 9.5px; font-weight: 600; }
.wk:hover { text-decoration: none; border-color: var(--brand-100); color: var(--brand); background: var(--brand-50); }
.wk.on { background: var(--brand); color: #fff; }
.day { min-height: 74px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); background: #fff; transition: border-color .12s, background .12s; min-width: 0; }
.day:hover { text-decoration: none; border-color: var(--brand); }
.day .dn { font-size: 13px; font-weight: 700; }
.day.out { background: transparent; border-color: transparent; color: #c9c1bd; }
.day.future { color: var(--muted); }
.day.today .dn { background: var(--brand); color: #fff; border-radius: 99px; padding: 0 7px; align-self: flex-start; }
.day.sel { background: var(--brand-50); border-color: #e2b9c2; }
.nums { display: flex; flex-wrap: wrap; gap: 3px; }
.nums b { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.cal-hint { margin: 12px 0 0; }
.stats.tight { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stats.tight .stat { box-shadow: none; }
.conv-bar { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.conv-bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.conv p { margin: 0; font-size: 14px; }
@media (max-width: 1180px) { .cc-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .cc-top { flex-direction: column; align-items: stretch; }
  .cc-user .field { min-width: 0; }
  .cc-top > * { min-width: 0; max-width: 100%; }
  .cc-top .seg { display: flex; flex-wrap: nowrap; }
  .cc-top .seg a { min-width: 0; }
  .cc-top .seg a { flex: 1; text-align: center; padding: 8px 4px; font-size: 13px; }
  .cc-top .custom-range input { flex: 1 1 0; width: 0; min-width: 0; }
  .cal-row { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); gap: 3px; }
  .day { min-height: 58px; padding: 4px 3px; border-radius: 8px; }
  .day .dn { font-size: 12px; }
  .nums { flex-direction: column; gap: 2px; }
  .nums b { font-size: 10px; padding: 0 3px; text-align: center; }
  .wk small { display: none; }
  .stats.tight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats.tight .stat-value { font-size: 20px; }
  .stats.tight .stat-label { font-size: 11.5px; }
}

/* ---------- Кіру ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(160deg, #7a1f33 0%, #4a1120 70%, #3a0d19 100%); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 64px; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .05); }
.auth-brand { display: flex; align-items: center; gap: 14px; }
.auth-brand div { display: flex; flex-direction: column; line-height: 1.1; }
.auth-brand b { font-size: 26px; letter-spacing: .18em; }
.auth-brand span { font-size: 13px; letter-spacing: .4em; opacity: .75; }
.auth-tag { font: 400 28px/1.3 var(--serif); max-width: 460px; margin-top: 40px; opacity: .95; }
.auth-card { align-self: center; justify-self: center; width: min(400px, calc(100% - 32px)); background: #fff; padding: 36px 32px; border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(31, 26, 28, .08); }
.auth-card h1 { margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 20px; }
.auth-card .btn-block { margin: 6px 0 14px; }
.auth.install { grid-template-columns: 1fr; padding: 32px 16px; }
.auth-card.wide { width: min(640px, 100%); }
.auth-card.wide .auth-brand { color: var(--brand); margin-bottom: 18px; }
.auth-card.wide .auth-brand .brand-mark { background: var(--brand); color: #fff; }
.checks { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--bad); font-weight: 700; } .checks .warn { color: var(--warn); }

/* ---------- Планшет ---------- */
@media (max-width: 1180px) {
  .grid-2, .client-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
  .form-grid.cols-5 .field { margin-bottom: 12px; }
}

/* ---------- Телефон ---------- */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 280px; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 10, 14, .45); z-index: 35; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 12px; gap: 6px; }
  .quick-search { max-width: none; }
  .hide-sm { display: none; }
  .content { padding: 16px 16px 96px; }
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 14px; align-items: flex-start; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 10px 24px rgba(122, 31, 51, .4); z-index: 25; }
  .card { padding: 16px; border-radius: 12px; margin-bottom: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 24px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-5 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .info { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .decision { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .cta-row { grid-template-columns: minmax(0, 1fr); }
  .big-search input { font-size: 16px; }
  .big-search .btn { padding: 10px 12px; }
  .bars a { grid-template-columns: 120px 1fr 32px; }
  .client-head { flex-direction: column; align-items: stretch; }
  .client-cta .btn { width: 100%; }
  .assigned { text-align: left; padding-top: 10px; border-top: 1px solid var(--line-2); }
  .phone-link { font-size: 18px; }
  .period { flex-direction: column; align-items: stretch; }
  .seg { display: flex; }
  .seg a { flex: 1; text-align: center; padding: 8px 6px; }
  .custom-range input { flex: 1; min-width: 0; }
  .filter-more select, .filter-more .inline, .filter-more .inline input { width: 100%; flex: 1 1 100%; }
  .comment-form { flex-direction: column; align-items: stretch; }
  .checks { grid-template-columns: 1fr; }
  .city-row { grid-template-columns: 1fr 1fr; }
  .city-row input[name=name] { grid-column: 1 / -1; }
  .inline-form { flex-direction: column; }
  .seg-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .seg-tabs a { justify-content: space-between; }

  /* Кестелер → карточкалар */
  .table-card .table thead, .clients-table thead, .rank-table thead, .users-table thead { display: none; }
  .clients-table tbody tr, .rank-table tbody tr, .users-table tbody tr:not(.edit-row) { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
  .clients-table td, .rank-table td, .users-table td { padding: 0; border: 0; display: flex; flex-direction: column; font-size: 14px; text-align: left !important; }
  .clients-table td[data-label]::before, .rank-table td[data-label]::before, .users-table td[data-label]::before { content: attr(data-label); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
  .clients-table .cell-main, .rank-table .cell-main, .users-table .cell-main { grid-column: 1 / -1; }
  .rank-table td:first-child { display: none; }
  .users-table td:last-child { grid-column: 1 / -1; }
  .edit-row td { display: block; padding: 14px; }
  .table.compact td, .table.compact th { padding: 8px 6px; }
  .table-card .table:not(.clients-table):not(.rank-table):not(.users-table) { font-size: 13px; }
  .table-card { overflow-x: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 40px 24px 80px; min-height: 0; }
  .auth-tag { font-size: 20px; margin-top: 20px; }
  .auth-card { margin-top: -50px; margin-bottom: 32px; padding: 28px 22px; }
}

/* ---------- Төлем чектері ---------- */
.receipt-form { margin-bottom: 14px; }
.file-field input[type=file] { display: block; width: 100%; padding: 12px; border: 1.5px dashed var(--line, #ddd); border-radius: 12px; background: var(--brand-50, #fbf3f5); cursor: pointer; font: inherit; }
.receipt-list { list-style: none; margin: 0; padding: 0; }
.receipt-list li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-2, #eee); }
.receipt-thumb { flex: 0 0 76px; width: 76px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2, #eee); background: #fafafa; display: flex; align-items: center; justify-content: center; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.receipt-doc { font-weight: 700; color: var(--brand); font-size: 15px; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.receipt-actions form.inline { display: inline; margin: 0; }
.btn.danger { color: #b42318; }
.client-cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.flash.warn { background: var(--warn-bg, #fff4e5); color: #7a4208; border-color: #f3d4ad; }
.flash.warn a { color: inherit; text-decoration: underline; margin-left: 6px; }

/* ---------- Колл-центр басты беті ---------- */
.cc-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.cc-kpi-item { padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line-2); min-width: 0; }
.cc-kpi-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.cc-kpi-val { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cc-kpi-item.ok .cc-kpi-val { color: var(--ok); }
.cc-kpi-item.accent .cc-kpi-val { color: var(--brand); }
.cc-kpi-sub { font-size: 12px; color: var(--muted); }
.cc-kpi-sub b { color: var(--ink-2); }
.cc-kpi-more { display: flex; align-items: center; gap: 10px; padding: 16px 20px; color: var(--brand); font-weight: 600; font-size: 14px; background: var(--brand-50); line-height: 1.25; }
.cc-kpi-more small { color: var(--muted); font-weight: 400; }
.cc-kpi-more:hover { text-decoration: none; background: var(--brand-100); }
.cc-todo, .cc-bottom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cc-bottom { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.cc-todo > .card, .cc-bottom > .card { margin-bottom: 18px; }
.cc-rows { list-style: none; margin: 0; padding: 0; }
.cc-rows li + li { border-top: 1px solid var(--line-2); }
.cc-rows a { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: inherit; }
.cc-rows a:hover { text-decoration: none; background: var(--brand-50); margin: 0 -10px; padding: 10px; border-radius: 10px; }
.cc-rows .grow { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cc-rows small { color: var(--muted); font-size: 13px; }
.cc-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); width: 46px; flex: none; }
.cc-call { font-size: 13px; font-weight: 600; color: var(--bad); white-space: nowrap; }
.cc-foot { display: inline-block; margin: 8px 0 0; }
.cc-table td small { display: block; }
.cc-table td a { color: var(--ink); }
.cc-feed { list-style: none; margin: 0; padding: 0; }
.cc-feed li + li { border-top: 1px solid var(--line-2); }
.cc-feed a { display: flex; gap: 10px; align-items: center; padding: 9px 0; color: inherit; }
.cc-feed a:hover { text-decoration: none; }
.cc-feed .notif-ic { width: 28px; height: 28px; }
.cc-feed .grow { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cc-feed b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-feed small { color: var(--muted); font-size: 12px; }
.cc-feed li.unread b { color: var(--brand); }
.cc-feed li.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-left: 6px; vertical-align: middle; }
@media (max-width: 1180px) {
  .cc-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-kpi-item { border-bottom: 1px solid var(--line-2); }
  .cc-kpi-more { grid-column: 1 / -1; justify-content: center; }
  .cc-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .cc-todo { grid-template-columns: minmax(0, 1fr); }
  .cc-kpi-item { padding: 12px 14px; }
  .cc-kpi-val { font-size: 28px; }
  .cc-table thead { display: none; }
  .cc-table, .cc-table tbody, .cc-table tr, .cc-table td { display: block; width: 100%; }
  .cc-table tr { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .cc-table td { padding: 0; border: 0; width: auto; }
  .cc-table td[data-label="Уақыты"] { grid-column: 1; grid-row: 1 / span 2; padding-top: 1px; }
  .cc-table td[data-label="Клиент"] { grid-column: 2; grid-row: 1; }
  .cc-table td[data-label="Консультант"] { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--ink-2); }
  .cc-table td[data-label="Жағдайы"] { grid-column: 3; grid-row: 1; align-self: start; }
  .cc-days { width: 100%; }
  .cc-days input[type=date] { flex: 1; }
}

.cc-visits .card-head h2 { flex-wrap: wrap; }
.cc-came { font-weight: 400; }
.cc-days { display: flex; align-items: center; gap: 4px; background: var(--line-2); border-radius: 12px; padding: 4px; margin: 0; }
.cc-days a { padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.cc-days a:hover { text-decoration: none; background: #fff; }
.cc-days a.on { background: var(--brand); color: #fff; }
.cc-days input[type=date] { width: auto; min-height: 0; padding: 6px 8px; font-size: 14px; border-radius: 9px; border-color: transparent; background: #fff; }
.cc-visits .cc-table td.cc-time { font-size: 16px; width: 70px; }
.cc-visits .cc-table tr.is-came, .cc-visits .cc-table tr.is-came td { background: #f6fbf8; }
@media (max-width: 860px) { .cc-visits .cc-table tr.is-came td { background: transparent; } }
.cc-visits .cc-table tr.is-late td.cc-time { color: var(--warn); }
.cc-tel { color: inherit; }
.cc-empty { padding: 4px 20px 6px; }
.cc-visits-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line-2); }

/* ---------- Менің аналитикам ---------- */
.ms-funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 8px; }
.ms-step { padding: 16px 18px; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; position: relative; min-width: 0; }
.ms-step:last-child { border-right: 0; }
.ms-label { font-size: 13px; font-weight: 600; color: var(--ink-2); padding-right: 46px; line-height: 1.3; min-height: 34px; }
.ms-side .ms-label, .ms-step:first-child .ms-label { padding-right: 0; }
.ms-val { font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--brand); }
.ms-conv { position: absolute; top: 14px; right: 14px; font-size: 12px; font-weight: 700; color: var(--ok); background: var(--ok-bg); padding: 2px 7px; border-radius: 99px; }
.ms-delta { font-size: 12px; color: var(--muted); }
.ms-delta.up { color: var(--ok); }
.ms-delta.down { color: var(--bad); }
.ms-side { background: #fcfbfa; }
.ms-side .ms-val { color: var(--warn); }
.ms-sub { font-size: 12px; color: var(--muted); }
.ms-note { margin: 0 0 18px; }
.ms-bars { list-style: none; margin: 0; padding: 0; }
.ms-bars li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 32px; gap: 10px; align-items: center; padding: 8px 0; }
.ms-bar-label { font-size: 14px; }
.ms-bar { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.ms-bar i { display: block; height: 100%; background: var(--warn); border-radius: 99px; }
.ms-bars b { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .ms-funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ms-step { border-bottom: 1px solid var(--line-2); }
  .ms-val { font-size: 26px; }
}
@media (max-width: 860px) {
  .custom-range input { width: 0; }
  .channel-table thead { display: none; }
  .channel-table, .channel-table tbody, .channel-table tfoot { display: block; }
  .channel-table tbody tr, .channel-table tfoot tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .channel-table td { padding: 0; border: 0; display: flex; flex-direction: column; font-size: 14px; text-align: left !important; background: transparent; }
  .channel-table td[data-label]::before { content: attr(data-label); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
  .channel-table .cell-main { grid-column: 1 / -1; }
  .channel-table tfoot tr { background: #fcfbfa; }
}
.text-brand { color: var(--brand); }
.ob-title { font-size: 17px; margin: 6px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.resched { border-color: #ddd0f5; }
.resched-bad { border-color: #f5c9c4; background: linear-gradient(180deg, #fffafa, #fff); }
.resched-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 12px; align-items: end; }
.resched-form .field { margin-bottom: 0; }
@media (max-width: 860px) { .resched-form { grid-template-columns: minmax(0, 1fr); } }
.cc-table td a.btn { color: var(--brand); }
.backup-receipts { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); margin-top: 8px; }
.backup-receipts .grow { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.btn.disabled { opacity: .5; pointer-events: none; }
.form-errors { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--bad-bg); border: 1px solid #f5c9c4; color: var(--bad); margin-bottom: 16px; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.field.is-missing input, .field.is-missing textarea { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.field.is-missing .chips { outline: 2px solid var(--bad-bg); outline-offset: 4px; border-radius: 10px; }

/* ---------- AI көмекші ---------- */
.ai-open { gap: 6px; border-color: var(--brand-100); color: var(--brand); background: var(--brand-50); }
.ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100vw; background: #fff; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(31, 26, 28, .12); z-index: 60; display: flex; flex-direction: column; }
.ai-panel[hidden] { display: none; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ai-head .grow { display: flex; flex-direction: column; flex: 1; }
.ai-head small { color: var(--muted); font-size: 12px; }
.ai-badge { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fbf9f8; }
.ai-msg { margin: 0; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; max-width: 92%; word-wrap: break-word; }
.ai-msg.bot { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-top-left-radius: 4px; }
.ai-msg.me { background: var(--brand); color: #fff; align-self: flex-end; border-top-right-radius: 4px; }
.ai-msg.err { background: var(--bad-bg); color: var(--bad); border-color: #f5c9c4; }
.ai-msg a { font-weight: 600; }
.ai-chips { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ai-chip { border: 1px solid var(--brand-100); background: #fff; color: var(--brand); border-radius: 99px; padding: 7px 12px; font: 500 13px/1.3 var(--font); cursor: pointer; text-align: left; }
.ai-chip:hover { background: var(--brand-50); }
.ai-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.ai-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 140px; }
.ai-dots { display: inline-flex; gap: 4px; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: aidot 1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aidot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (min-width: 1181px) { body.ai-on .main { margin-right: 400px; } }
@media (max-width: 860px) { .ai-panel { width: 100vw; } .ai-open { padding: 8px 10px; } }
.help-panel .ai-body { gap: 14px; }
.help-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.help-box > b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.help-box > b .ic { color: var(--brand); }
.help-warn { border-color: #f3d4ad; background: var(--warn-bg); color: #7a4208; }
.help-warn p { margin: 0; }
.help-find { display: flex; gap: 8px; }
.help-find input { flex: 1; min-width: 0; }
.help-result { font-size: 13.5px; line-height: 1.5; padding: 10px 12px; background: #fbf9f8; border-radius: 10px; border: 1px solid var(--line-2); }
.help-faq details { border-top: 1px solid var(--line-2); padding: 9px 0; }
.help-faq details:first-of-type { border-top: 0; }
.help-faq summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
.help-faq summary::after { content: "+"; color: var(--brand); font-weight: 700; }
.help-faq details[open] summary::after { content: "–"; }
.help-faq summary::-webkit-details-marker { display: none; }
.help-faq p { margin: 8px 0 2px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.stat-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; } .stat-link:hover { text-decoration: none; border-color: var(--brand-100); box-shadow: 0 6px 18px rgba(122,31,51,.10); }
