/* ===================== Base ===================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
    margin: 0;
    padding: 0;
}

/* ===================== Navigation bar ===================== */
body > div:first-child {
    background: #1e2d3d;
    padding: 10px 20px;
    overflow: hidden;
}

body > div:first-child .col-6 {
    float: left;
    margin-right: 32px;
}

.user-bar {
    float: right;
    color: #b0bec5;
    font-size: 12px;
    padding: 4px 0;
}

.user-bar a {
    color: #fff;
    text-decoration: underline;
}

body > div:first-child h3 {
    color: #7fb3d3;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 6px 0 5px;
}

body > div:first-child ul {
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
}

body > div:first-child li a {
    color: #b0bec5;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.9;
    display: block;
    border-left: 3px solid transparent;
    padding-left: 6px;
    margin-left: -9px;
}

body > div:first-child li a:hover {
    color: #fff;
}

body > div:first-child li a.menu-active {
    color: #fff;
    font-weight: 700;
    border-left-color: #7fb3d3;
}

/* ===================== Page headings ===================== */
h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1e2d3d;
    margin: 18px 20px 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #dde2ea;
}

.stat-bar {
    display: none; /* показывается через JS только при наличии #mTable */
    margin: 8px 20px 4px;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid #dde2ea;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.stat-bar__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 24px;
}

.stat-bar__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #999;
}

.stat-bar__val {
    font-size: 16px;
    font-weight: 700;
    color: #1e2d3d;
}

/* ===================== Filter form ===================== */
form {
    background: #fff;
    border: 1px solid #dde2ea;
    border-radius: 5px;
    padding: 8px 14px;
    margin: 0 20px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

form label {
    font-size: 13px;
    color: #555;
    margin: 0;
}

form input[type=text],
form input[type=password],
form select {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 7px;
    font-size: 13px;
    color: #333;
    background: #fff;
    height: 27px;
}

form input[type=text]:focus,
form input[type=password]:focus,
form select:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74,144,217,.15);
}

form input[type=submit] {
    background: #1e2d3d;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 4px 14px;
    cursor: pointer;
    font-size: 13px;
    height: 27px;
    transition: background .15s;
}

form input[type=submit]:hover {
    background: #2e4460;
}

/* ===================== Dropdown pay-type ===================== */
.ptd-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 13px;
    height: 27px;
    color: #333;
    transition: border-color .15s;
}

.ptd-btn:hover {
    border-color: #4a90d9;
}

.ptd-panel label {
    font-size: 13px;
    color: #333;
    cursor: pointer;
    font-weight: normal;
}

.ptd-reset {
    font-size: 11px;
    color: #999;
    text-decoration: none;
}

.ptd-reset:hover {
    color: #e74c3c;
    text-decoration: underline;
}

/* ===================== Collapse toggle ===================== */
.toglbut {
    background: #e8ecf0;
    color: #444;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 12px;
}

.toglbut:hover {
    background: #d0d8e2;
}

/* ===================== Tables ===================== */
/*
  display:block + overflow-x:auto — каждая таблица скроллируется
  независимо, страница не едет горизонтально.
  Tablesorter работает корректно: внутренние ячейки остаются table-cell.
*/
table:not(.stat):not(.ui-datepicker-calendar) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    margin-bottom: 16px;
    max-width: calc(100vw - 44px); /* 20px отступ слева + 24px запас */
}

table:not(.stat):not(.ui-datepicker-calendar) th,
table:not(.stat):not(.ui-datepicker-calendar) td {
    padding: 5px 9px;
    text-align: left;
    word-break: break-word;
    max-width: 320px;
}

/* Светлый заголовок — совместим с тёмными стрелками tablesorter */
table:not(.stat):not(.ui-datepicker-calendar) th {
    background: #edf1f7;
    color: #1e2d3d;
    font-weight: 700;
    font-size: 12px;
    border-bottom: 2px solid #c8d0dc;
    white-space: nowrap;
}

table:not(.stat):not(.ui-datepicker-calendar) td {
    border-bottom: 1px solid #edf0f3;
    vertical-align: top;
}

table:not(.stat):not(.ui-datepicker-calendar) tr:last-child td {
    border-bottom: none;
}

table:not(.stat):not(.ui-datepicker-calendar) tbody tr:nth-child(even) td {
    background: #f8fafc;
}

table:not(.stat):not(.ui-datepicker-calendar) tbody tr:hover td {
    background: #eef4fb;
}

/* Compact stat table — не блочная, без отступов */
table.stat {
    display: table;
    border-collapse: collapse;
    background: transparent;
    font-size: 12px;
    margin: 0;
}

table.stat tr td {
    padding: 1px 5px;
    border: none;
    background: transparent;
    vertical-align: middle;
}

table.stat tr td:first-child {
    color: #888;
}

/* Tablesorter filter-inputs */
.tablesorter-filter {
    font-size: 12px !important;
    padding: 2px 5px !important;
    border: 1px solid #ccc !important;
    border-radius: 3px !important;
    width: 100% !important;
}

/* all_wdg_stat: таблица фиксированной ширины, второй столбец (Виджет) = 3× среднего */
table.wdg-stat-table {
    display: table;
    table-layout: fixed;
    width: 100%;
}
table.wdg-stat-table th {
    white-space: normal;
    word-break: break-word;
}
.wdg-stat-table th:nth-child(2),
.wdg-stat-table td:nth-child(2) {
    width: 20%;
}

/* ===================== Отчёт "Оплаты по типам": сводка + график рядом ===================== */
.pt-report {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
    margin: 0 20px 16px;
}

.pt-summary {
    flex: 0 0 260px;
    background: #fff;
    border: 1px solid #dde2ea;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 10px 14px;
}

.pt-summary table.stat {
    width: 100%;
    font-size: 13px;
}

.pt-summary table.stat th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #999;
    padding: 0 5px 6px;
    border-bottom: 1px solid #edf0f3;
}

.pt-summary table.stat th:last-child,
.pt-summary table.stat td:last-child {
    text-align: right;
}

.pt-summary table.stat td {
    padding: 3px 5px;
}

.pt-summary table.stat tr.pt-total td {
    border-top: 2px solid #dde2ea;
    font-weight: 700;
    padding-top: 6px;
}

.pt-chart {
    flex: 1 1 480px;
    min-width: 0;
    background: #fff;
    border: 1px solid #dde2ea;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 12px;
}

/* ===================== Links ===================== */
a {
    color: #2980b9;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===================== Collapsible ===================== */
.collapsible {
    display: none;
}

.collapsible.open {
    display: block;
}
