* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #222;
    background: #fafafa;
}

/* ===== Login ===== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f3f3;
}
.login-card {
    width: 320px;
    padding: 32px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .subtitle { margin: 0 0 24px; color: #888; font-size: 13px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: #555; }
.login-card input {
    width: 100%;
    padding: 8px 10px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}
.login-card button {
    width: 100%;
    padding: 10px;
    background: #222;
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}
.login-card button:hover { background: #000; }
.login-card .error {
    color: #b00020;
    background: #fdecea;
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 14px;
    font-size: 13px;
}

/* ===== Main ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; }
.topbar .user { font-size: 13px; color: #666; white-space: nowrap; }
.topbar .user a { margin-left: 12px; color: #444; text-decoration: none; }
.topbar .user a:hover { text-decoration: underline; }
.topbar-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}
.topbar-actions .btn { padding: 6px 12px; font-size: 13px; }

/* Навигация по разделам — между заголовком и кнопками */
.tabs {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.tabs .tab {
    display: inline-block;
    padding: 6px 14px;
    font-size: 13px;
    color: #444;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    line-height: 1.2;
    white-space: nowrap;
}
.tabs .tab:hover { background: #f0f0f0; }
.tabs .tab.active {
    background: #1976d2;
    color: #fff;
    border-color: #1976d2;
}

main { padding: 10px 20px 20px; }

.meta {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
}
.meta .built-at { color: #444; }
.meta .built-at b { color: #111; font-weight: 600; }

.status { min-height: 18px; margin-left: auto; }
.status.ok { color: #1b8a4b; }
.status.err { color: #b00020; }
.status.progress { color: #555; }

.table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    /* кнопки переехали в topbar — таблице доступно больше высоты */
    max-height: calc(100vh - 110px);
}

table.report {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

table.report th,
table.report td {
    padding: 5px 6px;
    border-bottom: 1px solid #eee;
    border-right: 1px solid #f3f3f3;
    text-align: left;
    vertical-align: top;
}
table.report th {
    position: sticky;
    top: 0;
    background: #f7f7f7;
    font-weight: 600;
    color: #444;
    z-index: 2;
    border-bottom: 1px solid #ddd;
    /* allow wrapping between words but never inside a word */
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    line-height: 1.2;
    vertical-align: bottom;
    user-select: none;
    /* стрелка сортировки сидит абсолютно справа-снизу — не уходит на свою строку */
    padding-right: 16px;
}
table.report th .th-title {
    display: inline;
}
table.report th .sort-ind {
    position: absolute;
    right: 4px;
    bottom: 6px;
    width: 0;
    height: 0;
    opacity: 0.4;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #888;
}
table.report th.sortable { cursor: pointer; }
table.report th.sortable:hover { background: #efefef; }
table.report th.sort-asc .sort-ind {
    border-top: none;
    border-bottom: 5px solid #1976d2;
    opacity: 1;
}
table.report th.sort-desc .sort-ind {
    border-top: 5px solid #1976d2;
    opacity: 1;
}

/* Per-column widths to compress the table. Headers wrap, body cells clamp. */
.report th[data-key="borrower"],       .report td[data-key="borrower"]       { width: 160px; max-width: 200px; }
.report th[data-key="contract"],       .report td[data-key="contract"]       { width: 130px; max-width: 170px; }
.report th[data-key="contract_date"],  .report td[data-key="contract_date"]  { width: 80px; }
.report th[data-key="end_date"],       .report td[data-key="end_date"]       { width: 80px; }
.report th[data-key="contract_sum"],   .report td[data-key="contract_sum"]   { width: 95px; }
.report th[data-key="last_payment_date"], .report td[data-key="last_payment_date"] { width: 80px; }
.report th[data-key="rate"],           .report td[data-key="rate"]           { width: 50px; }
.report th[data-key="overdue"],        .report td[data-key="overdue"]        { width: 70px; }
.report th[data-key="contract_balance"], .report td[data-key="contract_balance"] { width: 95px; }
.report th[data-key="main_debt"],      .report td[data-key="main_debt"]      { width: 95px; }
.report th[data-key="interest"],       .report td[data-key="interest"]       { width: 90px; }
.report th[data-key="total"],          .report td[data-key="total"]          { width: 95px; }
.report th[data-key="note"],           .report td[data-key="note"]           { width: 200px; max-width: 240px; }
.report th[data-key="lawsuit"],        .report td[data-key="lawsuit"]        { width: 90px; max-width: 110px; }
.report th[data-key="pledges"],        .report td[data-key="pledges"]        { width: 220px; max-width: 280px; }
.report th[data-key="guarantors"],     .report td[data-key="guarantors"]     { width: 160px; max-width: 200px; }

/* В разделе «Поручители» колонки «Директор» / «Учредители» — многострочные:
   снимаем клэмп (по умолчанию у .cell-content -webkit-line-clamp: 2). */
.report th[data-key="directors_text"], .report td[data-key="directors_text"] { width: 220px; max-width: 280px; }
.report th[data-key="founders_text"],  .report td[data-key="founders_text"]  { width: 280px; max-width: 360px; }
.report td[data-key="directors_text"] .cell-content,
.report td[data-key="founders_text"]  .cell-content {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

table.report td.num,
table.report th.num {
    text-align: right;
    color: #999;
    width: 40px;
    white-space: nowrap;
}

table.report tbody tr:hover { background: #f8f9fb; }

/* ИТОГО row at the bottom of the table */
table.report tfoot tr.totals-row td {
    background: #f7f7f7;
    font-weight: 600;
    border-top: 2px solid #bbb;
    border-bottom: 1px solid #ccc;
    position: sticky;
    bottom: 0;
    z-index: 1;
    color: #222;
    white-space: nowrap;
    padding: 6px 6px;
}
table.report tfoot tr.totals-row td.num {
    color: #555;
    text-align: left;
}

/* Cell content — ровно 2 строки текста. */
.cell-content {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.35;
    min-width: 50px;
}
.cell-content.clamp2 {
    -webkit-line-clamp: 2;
}

/* Подстрока с телефоном / адресом под именем заявителя */
.sub-info {
    font-size: 0.78em;
    color: #888;
    line-height: 1.3;
    word-break: break-word;
}

/* Ячейка «Суды» с делами как ответчик — лёгкий акцент */
td.arb-defendant {
    background: #fff8e1;
}

/* Ссылка «Раскрыть» внутри ячейки */
.modal-link {
    display: inline-block;
    margin-top: 2px;
    font-size: 11px;
    color: #1976d2;
    text-decoration: none;
    cursor: pointer;
}
.modal-link:hover { text-decoration: underline; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 9px 16px;
    background: #fff;
    color: #222;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    line-height: 1.2;
    font-family: inherit;
}
.btn:hover { background: #f0f0f0; }
.btn.primary {
    background: #222;
    color: #fff;
    border-color: #222;
}
.btn.primary:hover { background: #000; }
.btn:disabled { opacity: 0.6; cursor: progress; }

/* ===== Modal (общие правила) ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card {
    position: relative;
    background: #fff;
    border-radius: 6px;
    padding: 22px 26px;
    width: 480px;
    max-width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.modal-card h2 { margin: 0 0 4px; font-size: 18px; }
.modal-card .hint { margin: 0 0 16px; font-size: 13px; color: #666; }
.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: 0;
    font-size: 22px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}
.modal-close:hover { color: #222; }
.modal-card form label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    color: #444;
}
.modal-card form label span {
    display: block;
    margin-bottom: 4px;
}
.modal-card form input[type="file"] {
    width: 100%;
    font-size: 13px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}
.upload-msg {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    min-height: 0;
}
.upload-msg:empty { padding: 0; }
.upload-msg.ok { background: #e8f5e9; color: #1b8a4b; }
.upload-msg.err { background: #fdecea; color: #b00020; }
.upload-msg.progress { background: #f1f3f4; color: #555; }

/* ===== Details modal (Заёмщик / Залоги / Поручители) ===== */
.details-card {
    width: 760px;
    max-width: 100%;
    max-height: 86vh;
    overflow-y: auto;
}
.details-card h2 { margin-bottom: 12px; padding-right: 32px; }
.details-body { font-size: 13px; }
.kv-section {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fafafa;
}
.kv-section h3 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #333;
}
.kv {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 8px 14px;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    line-height: 1.4;
}
.kv:last-child { border-bottom: none; }
.kv-label { color: #666; }
.kv-value { color: #111; white-space: pre-wrap; word-break: break-word; }

.modal-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.modal-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.modal-list li:last-child { border-bottom: none; }

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.modal-table th,
.modal-table td {
    border: 1px solid #e5e5e5;
    padding: 4px 8px;
    text-align: right;
}
.modal-table th { background: #f7f7f7; text-align: center; }
.modal-table td:first-child,
.modal-table th:first-child { text-align: center; }

/* ===== Исполнительные производства (ФССП) в модале «Заёмщик» ===== */
.ep-table td { text-align: left; vertical-align: top; }
.ep-table td:nth-child(2) { text-align: right; }
.ep-meta { color: #888; font-size: 11px; }
.ep-row-active   { background: #fff7e0; }
.ep-row-closed   { color: #888; }
.ep-status.active { color: #b54708; font-weight: 600; }
.ep-status.closed { color: #666; }
.ep-active-count { color: #b54708; }

/* ===== КАД Арбитр — роль участника ===== */
.kad-role { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 3px; }
.kad-role-истец    { background: #e0f0ff; color: #1a5fa8; }
.kad-role-ответчик { background: #fff0e0; color: #a85010; }
.kad-role-участник { background: #f0f0f0; color: #555; }

/* ===== Note modal ===== */
.note-card {
    width: 600px;
    max-width: 100%;
}
.note-card textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    resize: vertical;
}
.note-save-status {
    margin-right: auto;
    font-size: 12px;
}
.note-save-status.ok       { color: #1b8a4b; }
.note-save-status.err      { color: #b00020; }
.note-save-status.progress { color: #555; }

/* ===== Terrorist row highlight ===== */
tbody tr.terrorist > td { background: #fdecea !important; }
tbody tr.terrorist > td:first-child { box-shadow: inset 3px 0 0 #b00020; }
.terror-check { color: #555; }
.dadata-check { color: #555; }
.egrul-check  { color: #555; }

/* ===== Recovery row coloring ===== */
tbody tr.recovery-high     > td { background: #e8f5e9; }
tbody tr.recovery-medium   > td { background: #fff8e1; }
tbody tr.recovery-low      > td { background: #fdecea; }
tbody tr.recovery-recovered > td { background: #e3f2fd; }

/* ===== Logs page ===== */
.logs-wrap { max-height: calc(100vh - 110px); overflow-x: hidden; }
/* table-layout: fixed — ключевое: браузер не расширяет таблицу под содержимое,
   все ячейки обрезают/переносят текст, горизонтальный скролл исчезает. */
table.logs-table {
    font-size: 13px;
    table-layout: fixed;
    width: 100%;
}
table.logs-table th,
table.logs-table td {
    white-space: normal;
    vertical-align: top;
    padding: 6px 8px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
table.logs-table th.num,          table.logs-table td.num          { width: 40px; text-align: right; }
table.logs-table th.logs-date,    table.logs-table td.logs-date    { width: 90px;  white-space: nowrap; }
table.logs-table th.logs-time,    table.logs-table td.logs-time    { width: 80px;  white-space: nowrap; font-variant-numeric: tabular-nums; }
table.logs-table th.logs-type,    table.logs-table td.logs-type    { width: 190px; }
table.logs-table th.logs-duration,table.logs-table td.logs-duration{ width: 100px; white-space: nowrap; }
table.logs-table th.logs-status,  table.logs-table td.logs-status  { width: 200px; }
table.logs-table th.logs-note,    table.logs-table td.logs-note    { /* auto — займёт остаток */ }
table.logs-table th.logs-user,    table.logs-table td.logs-user    { width: 90px; white-space: nowrap; color: #555; }
/* Clamp длинных ячеек: статус и примечание — максимум 4 строки, остальное скрыто.
   Полный текст читается по hover-tooltip (title="...") на td. */
.logs-cell-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

tbody tr.log-status-ok          > td.logs-status { color: #1b8a4b; font-weight: 600; }
tbody tr.log-status-error       > td             { background: #fdecea; }
tbody tr.log-status-error       > td.logs-status { color: #b00020; font-weight: 600; }
tbody tr.log-status-in_progress > td             { background: #f1f3f4; }
tbody tr.log-status-in_progress > td.logs-status { color: #555; font-style: italic; }

td.logs-empty {
    text-align: center;
    color: #777;
    padding: 18px;
}
/* Ссылка «Раскрыть» внутри ячеек логов — тот же стиль что и .modal-link */
a.log-expand {
    display: inline-block;
    margin-top: 2px;
    font-size: 11px;
    color: #1976d2;
    text-decoration: none;
    cursor: pointer;
}
a.log-expand:hover { text-decoration: underline; }
/* Попап с полным текстом */
.log-text-card {
    width: 700px;
    max-width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}
.log-text-card h2 { margin-bottom: 14px; padding-right: 32px; font-size: 16px; }
.log-modal-body {
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    background: #f7f7f7;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 12px 14px;
}

/* ===== Heartbeat panel (мониторинг активных операций) ===== */
.heartbeat-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.hb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 5px;
    font-size: 13px;
    border: 1px solid transparent;
}
.hb-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.hb-label  { font-weight: 600; white-space: nowrap; }
.hb-status { flex: 1; }
.hb-started { color: #888; font-size: 12px; white-space: nowrap; }
.heartbeat-ts { font-size: 11px; color: #aaa; margin-left: auto; }

.hb-ok       { background: #e8f5e9; border-color: #a5d6a7; }
.hb-ok       .hb-dot    { background: #2e7d32; }
.hb-ok       .hb-status { color: #1b5e20; }

.hb-warn     { background: #fff8e1; border-color: #ffe082; }
.hb-warn     .hb-dot    { background: #f9a825; }
.hb-warn     .hb-status { color: #795548; }

.hb-dead     { background: #fdecea; border-color: #ef9a9a; }
.hb-dead     .hb-dot    { background: #b00020; animation: hb-pulse 1.2s infinite; }
.hb-dead     .hb-status { color: #b00020; font-weight: 600; }

.hb-starting { background: #f1f3f4; border-color: #ccc; }
.hb-starting .hb-dot    { background: #90a4ae; }
.hb-starting .hb-status { color: #546e7a; }

@keyframes hb-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.hb-cancel-btn {
    display: block;
    margin: 8px 0 4px;
    padding: 5px 14px;
    background: #b00020;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.hb-cancel-btn:hover { background: #8b0018; }

/* Маркеры Контур.Фокус */
.kontur-markers { display: flex; flex-wrap: wrap; gap: 6px; }
.kontur-badge {
    display: inline-block; padding: 3px 8px; border-radius: 12px;
    font-size: 12px; font-weight: 600; white-space: normal; line-height: 1.3;
}
.kontur-badge-red    { background: #fdecea; color: #b00020; border: 1px solid #f5c6cb; }
.kontur-badge-yellow { background: #fff8e1; color: #7d5a00; border: 1px solid #ffe082; }
.kontur-badge-green  { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.kontur-badge-gray   { background: #f5f5f5; color: #555;    border: 1px solid #ddd; }

/* Флаги СПАРК (исполнительные производства) */
.spark-flag { display: block; color: #b00020; font-size: 12px; margin-top: 4px; }

/* ===== Applicants search / filter toolbar ===== */
.app-toolbar { margin-bottom: 8px; }

.app-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.app-search-input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    width: 260px;
}
.app-search-input:focus { outline: none; border-color: #1976d2; }

.meta-inline { font-size: 12px; color: #666; }

.btn-active {
    background: #e3f0fd !important;
    border-color: #1976d2 !important;
    color: #1256a3 !important;
}

.btn-sm { padding: 5px 12px; font-size: 12px; }

.app-filter-panel {
    margin-top: 8px;
    padding: 14px 16px 10px;
    background: #fff;
    border: 1px solid #dde;
    border-radius: 6px;
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 170px;
}
.filter-field-wide { min-width: 280px; }

.filter-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-field input[type="text"],
.filter-field input[type="number"] {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
}
.filter-field input[type="text"]:focus,
.filter-field input[type="number"]:focus { outline: none; border-color: #1976d2; }

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}
.checkbox-group label,
.checkbox-group-col label {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
}
.checkbox-group-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-scroll {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.checkbox-scroll label {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.range-inputs input { width: 72px !important; }
.range-inputs span { color: #888; font-size: 14px; }

.filter-subrow { margin-top: 6px; }

.filter-actions { margin-top: 12px; }

/* ===== Займы Обзвон ===== */
.callout-table td, .callout-table th { vertical-align: top; }
.callout-col { min-width: 220px; width: 260px; }
.obzvon-textarea {
    width: 100%;
    padding: 5px 7px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.obzvon-textarea:focus { border-color: #1976d2; outline: none; }
.obzvon-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.btn-sm { padding: 3px 10px; font-size: 12px; }
.obzvon-status { font-size: 11px; }
.obzvon-status.ok  { color: #1b8a4b; }
.obzvon-status.err { color: #b00020; }
.obzvon-status.progress { color: #555; }
.obzvon-readonly { font-size: 12px; color: #444; white-space: pre-wrap; }
.cell-sub { font-size: 11px; color: #888; margin-top: 2px; }
.overdue-days { font-weight: 600; color: #b00020; text-align: center; }

/* ===== Сбор данных ===== */
.ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    padding: 4px 0 20px;
}
.op-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.op-card-active { border-color: #1976d2; box-shadow: 0 0 0 2px rgba(25,118,210,.15); }
.op-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.op-card-title { font-size: 14px; font-weight: 600; color: #111; }
.op-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}
.op-badge-ok      { background: #e8f5e9; color: #1b8a4b; }
.op-badge-err     { background: #fdecea; color: #b00020; }
.op-badge-running { background: #e3f2fd; color: #1565c0; }
.op-card-desc { font-size: 12px; color: #555; line-height: 1.5; }
.op-meta-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.op-meta-table td { padding: 2px 0; vertical-align: top; }
.op-meta-label { color: #888; width: 140px; white-space: nowrap; padding-right: 8px; }
.op-status-ok    { color: #1b8a4b; }
.op-status-error { color: #b00020; }
.op-status-in_progress { color: #1565c0; }
.op-note-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
}
.op-note-expand { font-size: 11px; color: #1976d2; text-decoration: none; }
.op-note-expand:hover { text-decoration: underline; }
.op-no-runs { font-size: 12px; color: #aaa; font-style: italic; }
.op-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.btn-danger {
    background: #fff;
    color: #b00020;
    border: 1px solid #e57373;
}
.btn-danger:hover:not(:disabled) { background: #fdecea; }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Ссылка «Подробнее» и попап алгоритма на странице «Сбор данных» ---- */
.op-detail-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    color: #1976d2;
    text-decoration: none;
}
.op-detail-link:hover { text-decoration: underline; }

.op-detail-card {
    max-width: 680px;
    width: 94vw;
    max-height: 82vh;
    overflow-y: auto;
}

.op-detail-body { font-size: 13px; line-height: 1.6; color: #333; }
.op-detail-body section { margin-bottom: 18px; }
.op-detail-body h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #111;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 4px;
}
.op-detail-body p { margin: 0 0 8px; }
.op-detail-body ol, .op-detail-body ul {
    margin: 0 0 8px;
    padding-left: 20px;
}
.op-detail-body li { margin-bottom: 4px; }
.op-detail-body li > ul, .op-detail-body li > ol { margin-top: 4px; margin-bottom: 0; }
.op-detail-body code {
    background: #f0f0f0;
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 12px;
    font-family: "Consolas", "Courier New", monospace;
}


/* ---- Расписание (раздел «Просроченные займы») ---- */
.raspisanie-col { min-width: 180px; width: 200px; }
.rasp-textarea { width: 100%; box-sizing: border-box; font-size: 12px; padding: 4px 6px; border: 1px solid #ccc; border-radius: 4px; resize: vertical; }
.rasp-actions { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.rasp-status { font-size: 11px; }
.rasp-status.ok       { color: #1b8a4b; }
.rasp-status.err      { color: #b00020; }
.rasp-status.progress { color: #888; }
.rasp-readonly { font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* ---- Учётные записи ---- */
.accounts-table { min-width: 700px; }
.accounts-table td, .accounts-table th { vertical-align: middle; }
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.role-admin    { background: #e3f2fd; color: #1565c0; }
.role-economist{ background: #e8f5e9; color: #2e7d32; }
.role-lawyer   { background: #fff3e0; color: #e65100; }
.role-director { background: #f3e5f5; color: #6a1b9a; }
.pwd-cell      { font-size: 16px; letter-spacing: 2px; color: #999; }

/* ---- Учётные записи: смена пароля ---- */
.acc-actions { white-space: nowrap; }
.acc-note    { color: #999; font-size: 12px; font-style: italic; }
.pwd-display { font-family: monospace; font-size: 14px; }
.pwd-input   { font-family: monospace; font-size: 13px; padding: 3px 6px; border: 1px solid #1976d2; border-radius: 4px; }
.pwd-row-status { font-size: 11px; margin-left: 6px; }
.pwd-row-status.ok       { color: #1b8a4b; }
.pwd-row-status.err      { color: #b00020; }
.pwd-row-status.progress { color: #888; }
