/* Компактный инженерный стиль поверх Bootstrap 4.6 */
:root {
    --ink: #1f2933;
    --muted: #6b7785;
    --line: #d9dee3;
    --panel: #ffffff;
    --bg: #eef1f4;
}
html { font-size: 14px; }
body { background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.page { padding: 10px 12px 30px; }
/* На больших мониторах контент занимает 80% ширины по центру, чтобы таблицы не растягивались */
@media (min-width: 1400px) {
    .page { width: 85%; max-width: 1900px; margin: 0 auto; }
}
h1, h2, h3, h4, h5 { font-weight: 600; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }

/* Навигация */
.navbar .nav-link { padding: .55rem .6rem; font-size: 13.5px; white-space: nowrap; color: rgba(255,255,255,.82); }
.navbar .nav-link:hover { color: #fff; }
.navbar .nav-item.active .nav-link { color: #fff; box-shadow: inset 0 -2px 0 #ffc107; }
.navbar .badge { font-size: 10px; vertical-align: text-top; }
.navbar .nav-user { color: rgba(255,255,255,.6); cursor: default; }
.navbar form .nav-link { line-height: inherit; }
.brand-text { font-weight: 600; letter-spacing: .04em; }

/* Панели */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; margin-bottom: 10px; }
.panel-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.toolbar .form-control { min-width: 140px; }

/* Таблицы */
.table { font-size: 13.5px; margin-bottom: 0; }
.table-sm td, .table-sm th { padding: .3rem .4rem; }
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom-width: 1px; background: #f7f8fa; white-space: nowrap; }
.table-bordered td, .table-bordered th { border-color: var(--line); }
.table-hover tbody tr:hover { background: #f3f7fb; }
.table td { vertical-align: middle; }
tr.row-done { background: #e6f6e6; }
tr.row-mine td:first-child { box-shadow: inset 3px 0 0 #0d6efd; }
.num { font-variant-numeric: tabular-nums; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.muted { color: var(--muted); }
.small-info { font-size: 12.5px; line-height: 1.35; color: #3c4854; }
.small-info ul { padding-left: 16px; margin: 2px 0; }
.nowrap { white-space: nowrap; }
.w-1 { width: 1%; }

/* Кнопки и элементы */
.btn { font-size: 13.5px; }
.btn-xs { padding: .15rem .45rem; font-size: 12.5px; line-height: 1.4; border-radius: 2px; }
.btn-icon { padding: .1rem .35rem; line-height: 1; }
.chip { display: inline-block; padding: 1px 6px; border-radius: 2px; font-size: 12px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.chip-open { background: #e3ecf7; color: #1b4f8a; }
.chip-done { background: #d9f2dc; color: #1a6b2d; }
.chip-closed { background: #e6e8eb; color: #4a5560; }
.chip-warn { background: #fff1cc; color: #7a5a00; }
.chip-danger { background: #fde2e1; color: #8f1d1d; }
.progress-thin { height: 5px; background: #e2e6ea; border-radius: 2px; overflow: hidden; margin-top: 2px; }
.progress-thin > span { display: block; height: 100%; background: #2e7d32; }
.form-control, .custom-select { font-size: 14px; }
.form-control-sm { font-size: 13px; height: calc(1.5em + .5rem + 2px); }
label { margin-bottom: .2rem; font-size: 13px; color: #3c4854; }
.form-group { margin-bottom: .6rem; }
.notice { font-size: 13px; }
.notice summary { cursor: pointer; color: #8f1d1d; font-weight: 600; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 12px; }
.check-grid label { font-size: 13.5px; color: var(--ink); }

/* Модальные окна */
.modal-content { border-radius: 3px; overflow: visible; }
.modal-header { padding: .6rem 1rem; }
.modal-body { padding: .8rem 1rem; }
.modal-footer { padding: .5rem 1rem; }
.preview-frame { width: 100%; height: 80vh; border: 0; }
/* select2: единый вид с form-control, подсветка совпадений */
.select2-container { font-size: 14px; }
.select2-container--default .select2-selection--single { height: calc(1.5em + .75rem + 2px); border-color: #ced4da; border-radius: .25rem; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: calc(1.5em + .75rem); font-size: 14px; padding-left: .75rem; color: var(--ink); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(1.5em + .75rem); }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #6c757d; }
.form-control-sm + .select2-container .select2-selection--single { height: calc(1.5em + .5rem + 2px); }
.form-control-sm + .select2-container .select2-selection--single .select2-selection__rendered { line-height: calc(1.5em + .5rem); font-size: 13px; }
.form-control-sm + .select2-container .select2-selection--single .select2-selection__arrow { height: calc(1.5em + .5rem); }
.select2-container--default .select2-selection--multiple { border-color: #ced4da; border-radius: .25rem; min-height: calc(1.5em + .75rem + 2px); }
.select2-container--default .select2-selection--multiple .select2-selection__choice { background: #e3ecf7; border-color: #b9cde6; color: #1b4f8a; font-size: 13px; padding: 0 6px; margin-top: 4px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: #1b4f8a; margin-right: 4px; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--focus .select2-selection--single { border-color: #80bdff; box-shadow: 0 0 0 .2rem rgba(0,123,255,.25); }
.select2-dropdown { border-color: #ced4da; font-size: 14px; }
.select2-search--dropdown .select2-search__field { font-size: 14px; padding: 4px 6px; border-color: #ced4da; }
.select2-results__option { padding: 4px 8px; }
.select2-results__option mark { background: #ffe58a; color: inherit; padding: 0; border-radius: 2px; font-weight: 600; }
.select2-container--default .select2-results__option--highlighted[aria-selected] mark { background: #ffd54a; color: #1f2933; }
.select2-container--open .select2-dropdown { z-index: 1060; }
.modal .select2-container { z-index: 1061; }

/* Дашборд */
.kpi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kpi .tile { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; }
.kpi .tile .v { font-size: 23px; font-weight: 600; line-height: 1.1; }
.kpi .tile .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* Чат */
.chat-window { height: 65vh; overflow-y: auto; border: 1px solid var(--line); padding: 8px; background: #fff; }
.msg { margin-bottom: 6px; }
.msg .bubble { display: inline-block; max-width: 80%; padding: 6px 10px; border-radius: 6px; background: #f0f2f5; text-align: left; }
.msg.me { text-align: right; }
.msg.me .bubble { background: #d9ebff; }
.msg .who { font-weight: 600; font-size: 12.5px; }
.msg .when { font-size: 11.5px; color: var(--muted); }

/* Комментарии */
.comment { border-bottom: 1px solid var(--line); padding: 6px 0; }
.comment img { max-height: 160px; border: 1px solid var(--line); border-radius: 2px; }

/* Печать */
@media print {
    .navbar, .toolbar, .btn, .no-print, form { display: none !important; }
    .page { padding: 0; }
    .panel { border: 0; }
}
@media (max-width: 767px) {
    .page { padding: 6px; }
    .table { font-size: 13px; }
}
