/* OLAP (olap.ak-i.ru): оформление поверх Bootstrap 5. Только внешний вид – логика и данные не меняются.
   Подключается последним в index.html; откат – убрать строку <link ... olap-theme.css>. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --ak-bg: #f3f5fa;
  --ak-surface: #ffffff;
  --ak-ink: #1f2937;
  --ak-muted: #6b7280;
  --ak-line: #e5e8f0;
  --ak-brand: #2952cc;
  --ak-brand-dark: #1b3a9a;
  --ak-brand-soft: #eaf0ff;
  --ak-nav: #141c2f;
  --ak-radius: 12px;
  --ak-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
  --ak-shadow-hover: 0 2px 4px rgba(16, 24, 40, .06), 0 12px 28px rgba(16, 24, 40, .12);
}

body {
  background: var(--ak-bg) !important;
  color: var(--ak-ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- шапка ---------- */
.navbar.bg-dark {
  background: var(--ak-nav) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
  padding-top: .7rem;
  padding-bottom: .7rem;
  margin-bottom: 1.25rem;
}
.navbar.bg-dark a[href="/"] {
  font-weight: 700 !important;
  letter-spacing: .2px;
  text-decoration: none !important;
  font-size: 1.1rem;
}
.navbar.bg-dark a[href="/"]::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, #5b8cff, #2952cc);
  vertical-align: 1px;
}
.navbar-dark .navbar-nav .nav-link,
.navbar.bg-dark .nav-link {
  color: rgba(255, 255, 255, .72) !important;
  border-radius: 8px;
  padding: .35rem .8rem !important;
  transition: background .15s, color .15s;
}
.navbar.bg-dark .nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, .08);
}

/* ---------- хлебные крошки ---------- */
.breadcrumb {
  font-size: .9rem;
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--ak-brand); text-decoration: none; }
.breadcrumb-item.active { color: var(--ak-muted); }

/* ---------- карточки на главной ---------- */
.card {
  border: 1px solid var(--ak-line) !important;
  border-radius: var(--ak-radius) !important;
  box-shadow: var(--ak-shadow);
  background: var(--ak-surface);
}
.myCard {
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  overflow: hidden;
}
.myCard:hover {
  background-color: var(--ak-surface) !important;
  border-color: #c9d6ff !important;
  box-shadow: var(--ak-shadow-hover) !important;
  transform: translateY(-2px);
}
.myCard .card-body { padding: 1.25rem 1.4rem; }
.myCard .card-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ak-ink);
  margin-bottom: .6rem;
}
.myCard .card-title::after {
  content: "→";
  float: right;
  color: var(--ak-brand);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .15s, transform .15s;
}
.myCard:hover .card-title::after { opacity: 1; transform: none; }
.myCard .card-text { color: var(--ak-muted); font-size: .92rem; }
.myCard ul { padding-left: 1.1rem; margin-bottom: 0; }
.myCard li { margin: .15rem 0; }
.myCard li::marker { color: #9fb3f5; }

/* ---------- кнопки и поля ---------- */
.btn {
  border-radius: 8px;
  font-weight: 500;
  transition: transform .05s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ak-brand); border-color: var(--ak-brand); }
.btn-primary:hover { background: var(--ak-brand-dark); border-color: var(--ak-brand-dark); }
.form-control, .form-select {
  border-radius: 8px;
  border-color: #d5dbe7;
}
.form-control:focus, .form-select:focus {
  border-color: #8aa6f5;
  box-shadow: 0 0 0 3px rgba(41, 82, 204, .15);
}
.form-label, label { color: #374151; font-weight: 500; }

/* ---------- вкладки месяцев ---------- */
.nav-tabs {
  border-bottom: 1px solid var(--ak-line);
  gap: 4px;
}
.nav-tabs .nav-link {
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  color: var(--ak-muted);
  font-weight: 500;
  background: transparent !important;
}
.nav-tabs .nav-link:hover { color: var(--ak-brand); }
.nav-tabs .nav-link.active {
  color: var(--ak-brand) !important;
  border-bottom-color: var(--ak-brand) !important;
  font-weight: 700;
}

/* ---------- таблицы отчётов ---------- */
.table {
  --bs-table-bg: var(--ak-surface);
  border-color: var(--ak-line) !important;
  font-size: .86rem;
  margin-bottom: .75rem;
}
.table > :not(caption) > * > * { padding: .5rem .6rem; }
.table thead th,
.table-dark thead th,
thead.table-dark th {
  background: #eef2fb !important;
  color: #334155 !important;
  border-color: #dde3f0 !important;
  font-weight: 600;
  font-size: .78rem;
  text-transform: none;
  vertical-align: middle;
}
.table thead { position: sticky; top: 0; z-index: 2; }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: #f5f8ff; }
.table a { color: var(--ak-brand); }
/* таблицы внутри прокручиваемых блоков – рамка и скругление */
div[style*="overflow"] {
  border: 1px solid var(--ak-line);
  border-radius: 10px;
  background: var(--ak-surface);
}
div[style*="overflow"] > .table { margin-bottom: 0; }

/* ---------- календарь дней рождения (тёмная таблица) ---------- */
.table-dark {
  --bs-table-bg: #1b2440;
  --bs-table-striped-bg: #1f2a4a;
  --bs-table-hover-bg: #26345c;
  border-color: #2a365a !important;
  border-radius: var(--ak-radius);
  overflow: hidden;
  box-shadow: var(--ak-shadow);
}
.table-dark thead th {
  background: #141c2f !important;
  color: #e5e9f5 !important;
  border-color: #2a365a !important;
}
.table-dark thead h4 { margin: 0; font-weight: 700; font-size: 1.25rem; }
.table-dark .bi-arrow-left-circle-fill,
.table-dark .bi-arrow-right-circle-fill { color: #7ea2ff; }
.table-dark tbody th, .table-dark tbody td { font-weight: 600; padding: .65rem .3rem; }

/* ---------- списки (дни рождения и др.) ---------- */
.list-group { border-radius: var(--ak-radius); box-shadow: var(--ak-shadow); }
.list-group-item { border-color: var(--ak-line); padding: .8rem 1rem; }
.badge { border-radius: 999px; font-weight: 600; padding: .35em .7em; }

/* ---------- окна и подсказки ---------- */
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 24px 60px rgba(16, 24, 40, .25); }
.modal-header, .modal-footer { border-color: var(--ak-line); }
.popover { border-radius: 10px; border-color: var(--ak-line); box-shadow: var(--ak-shadow-hover); }

/* ---------- форма входа ---------- */
.container > .card:only-child,
.d-flex.justify-content-center > .card {
  border-radius: 16px !important;
  box-shadow: 0 10px 40px rgba(16, 24, 40, .1);
}

/* ---------- полосы прокрутки ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c7cfdf; border-radius: 10px; border: 2px solid var(--ak-bg); }
::-webkit-scrollbar-track { background: transparent; }

/* таблица «Учёт продаж» была в окне 300px – делаем выше */
div[style*="max-height: 300px"] { max-height: 65vh !important; }

/* ---------- главная: плитки отчётов ---------- */
.row:has(> .myCard) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 16px;
}
@media (max-width: 767px) { .row:has(> .myCard) { grid-template-columns: 1fr; } }
.row > .myCard.card { width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
.myCard > a.nav-link { display: block; height: 100%; padding: 0 !important; }
.myCard .card-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px !important; height: 100%; }
.myCard .card-title {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.05rem !important; line-height: 1.3; margin: 0 !important; min-height: 40px;
}
.myCard .card-title::before {
  font-family: "bootstrap-icons"; font-weight: normal; font-size: 18px;
  flex: 0 0 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ic, #2952cc); background: var(--ic-bg, #eaf0ff);
  content: "\f17c";
}
.myCard .card-title::after { margin-left: auto; }
.myCard:has(a[href="/sale1"]) { --ic: #2952cc; --ic-bg: #eaf0ff; }
.myCard:has(a[href="/sale1"]) .card-title::before { content: "\f2ee"; }
.myCard:has(a[href="/sale2"]) { --ic: #7c3aed; --ic-bg: #f1eaff; }
.myCard:has(a[href="/sale2"]) .card-title::before { content: "\f4dd"; }
.myCard:has(a[href="/sale6"]) { --ic: #059669; --ic-bg: #e3f7ef; }
.myCard:has(a[href="/sale6"]) .card-title::before { content: "\f46d"; }
.myCard:has(a[href="/sale4"]) { --ic: #d97706; --ic-bg: #fff3df; }
.myCard:has(a[href="/sale4"]) .card-title::before { content: "\f17c"; }
.myCard:has(a[href="/sale7"]) { --ic: #dc2626; --ic-bg: #fdeaea; }
.myCard:has(a[href="/sale7"]) .card-title::before { content: "\f672"; }
.myCard:has(a[href="/up"]) { --ic: #0e7490; --ic-bg: #e0f4f8; }
.myCard:has(a[href="/up"]) .card-title::before { content: "\f632"; }
.myCard:hover { border-color: var(--ic, #c9d6ff) !important; }
.myCard .card-text { margin: 0 !important; font-size: .88rem !important; line-height: 1.45; }
/* короткие описания вместо длинных текстов и списков (текст карточки скрыт, показываем свой) */
.myCard ul { display: none !important; }
.myCard .card-text { font-size: 0 !important; line-height: 0; }
.myCard .card-text::before { font-size: .88rem; line-height: 1.45; display: block; color: var(--ak-muted); }
.myCard a[href="/sale1"] .card-text::before { content: "Новые партнёры по регионам и правовой форме."; }
.myCard a[href="/sale2"] .card-text::before { content: "Работа менеджеров: лиды, статусы, звонки, отказы."; }
.myCard a[href="/sale6"] .card-text::before { content: "Сколько новых партнёров активировалось по регионам."; }
.myCard a[href="/sale4"] .card-text::before { content: "Партнёры по городам: количество и суммы за период."; }
.myCard a[href="/sale7"] .card-text::before { content: "Доля отказов по регионам помесячно."; }
.myCard a[href="/up"] .card-text::before { content: "Сделки по месяцам: поиск, правка, возвраты, выгрузка в Excel."; }


/* ---------- главная: дни рождения ---------- */
.list-group-numbered .badge { display: none !important; }          /* плашка филиала */
.list-group-numbered::before {
  content: "🎂 Дни рождения в этом месяце";
  display: block; padding: .75rem 1rem; font-weight: 700; font-size: .95rem;
  border-bottom: 1px solid var(--ak-line); background: var(--ak-surface);
}

/* ---------- главная: календарь – светлый ---------- */
.table-dark {
  --bs-table-bg: var(--ak-surface) !important;
  --bs-table-striped-bg: var(--ak-surface) !important;
  --bs-table-hover-bg: #f5f8ff !important;
  --bs-table-color: var(--ak-ink) !important;
  --bs-table-striped-color: var(--ak-ink) !important;
  --bs-table-hover-color: var(--ak-ink) !important;
  color: var(--ak-ink) !important;
  border: 1px solid var(--ak-line) !important;
  border-collapse: separate; border-spacing: 0;
}
.table-dark > :not(caption) > * > * { border-color: transparent !important; box-shadow: none !important; }
.table-dark thead th { background: var(--ak-surface) !important; color: var(--ak-ink) !important; border: 0 !important; }
.table-dark thead tr:first-child th { padding-top: .8rem; }
.table-dark thead h4 { font-size: 1.1rem; color: var(--ak-ink); }
.table-dark thead tr:last-child th { color: var(--ak-muted) !important; font-size: .72rem; font-weight: 600; padding-bottom: .4rem; }
.table-dark .bi-arrow-left-circle-fill, .table-dark .bi-arrow-right-circle-fill { color: var(--ak-brand); }
.table-dark tbody th, .table-dark tbody td { font-weight: 500; padding: .5rem .2rem !important; }
.table-dark tbody th[style*="color: red"] { color: #e0607a !important; font-weight: 500; }   /* выходные */
.table-dark tbody th[style*="orange"] {                                                       /* дни рождения */
  color: #b45309 !important; font-weight: 700; cursor: pointer;
  background: radial-gradient(circle, #ffedd5 15px, rgba(255, 237, 213, 0) 16px) no-repeat center / 100% 100%, var(--ak-surface) !important;
}

/* ---------- главная: пропорции ---------- */
.col-md-8 > .row:has(> .myCard) { grid-auto-rows: 1fr; }               /* все плитки одной высоты */
.col-md-8 > .row:has(> .myCard) + hr { display: none; }                /* лишняя полоса под плитками */
.myCard .card-title { min-height: 48px; }
/* правая колонка: календарь и дни рождения – две аккуратные карточки */
.col-md-4 > .table-responsive-md {
  background: var(--ak-surface); border: 1px solid var(--ak-line); border-radius: var(--ak-radius);
  box-shadow: var(--ak-shadow); padding: 12px 14px 8px; margin-bottom: 16px; overflow: hidden;
}
.col-md-4 > .table-responsive-md > .table-dark {
  border: 0 !important; box-shadow: none !important; border-radius: 0; margin: 0 !important;
  table-layout: fixed; width: 100%;
}
.table-dark thead th:first-child, .table-dark thead th:last-child { width: 14.2857%; }
.table-dark thead tr:first-child th { padding: 0 0 .7rem !important; vertical-align: middle; }
.table-dark thead tr:last-child th, .table-dark tbody th, .table-dark tbody td { text-align: center; padding: .45rem 0 !important; }
.col-md-4 > .list-group-numbered {
  border: 1px solid var(--ak-line); border-radius: var(--ak-radius); overflow: hidden;
  background: var(--ak-surface); box-shadow: var(--ak-shadow);
}
.list-group-numbered > .list-group-item {
  border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0 !important;
  padding: .6rem 1rem; align-items: center !important;
}
.list-group-numbered > .list-group-item .ms-2 { display: flex; justify-content: space-between; align-items: baseline; width: 100%; gap: 8px; }
.list-group-numbered > .list-group-item .ms-2 b { color: #b45309 !important; font-weight: 600; font-size: .85rem; white-space: nowrap; }

/* номера в списке дней рождения – одинаковой ширины, имена встают в одну линию */
.list-group-numbered > .list-group-item { font-variant-numeric: tabular-nums; }
.list-group-numbered > .list-group-item::before { min-width: 1.4em; display: inline-block; }
