/* =============================================
   tables.css — единые таблицы ЛК
   Эталоны: A01 · B02 · C03 · D04
   Scope: #rcl-office, модалки ЛK, .entry-content .bld-tasks-table
   Форма сделки (.rcl-public-box) — исключена
   v1.2.0 — единый источник table chrome (фазы 1–3)
   ============================================= */

#rcl-office,
.ssi-modalContent,
.rcl-dialog-tab,
.entry-content {
    --tbl-metal-head: linear-gradient(180deg, #121212 0%, #060606 42%, #010101 100%);
    --tbl-metal-row: linear-gradient(180deg, #3a3a3a 0%, #282828 40%, #1c1c1c 100%);
    --tbl-metal-row-alt: linear-gradient(180deg, #343434 0%, #242424 40%, #181818 100%);
    --tbl-metal-label: linear-gradient(180deg, #222 0%, #141414 45%, #0a0a0a 100%);
    --tbl-metal-edge: inset 0 0 3px #444, 0 0 5px #000000, 0 0 2px #000000;
    --tbl-metal-hover:
        inset 0 0 3px #444,
        0 0 5px #000000,
        0 0 2px #000000,
        0 0 0 1px var(--links, #dbb300),
        0 0 12px rgba(219, 179, 0, 0.25);
    --tbl-gap: 3px;
    --tbl-row-gap: 8px;
}

/* ---------- Общее: ссылки в таблицах без подчёркивания ---------- */

#rcl-office .rcl-table a,
#rcl-office table a,
#rcl-office .fng-task-list a,
.ssi-modalContent .rcl-table a,
.ssi-modalContent table a,
.rcl-dialog-tab .rcl-table a,
.rcl-dialog-tab table a {
    text-decoration: none !important;
}

#rcl-office .rcl-table a:hover,
#rcl-office table a:hover,
#rcl-office .fng-task-list a:hover,
#rcl-office #tab-publics .rcl_author_postlist a:hover,
.ssi-modalContent .rcl-table a:hover,
.ssi-modalContent table a:hover {
    color: var(--links-hover, #a1a1a1);
    text-decoration: none !important;
}

/* =============================================
   ТИП A — Rcl grid (.rcl-table) — A01
   ============================================= */

#rcl-office .rcl-table,
.ssi-modalContent .rcl-table,
.rcl-dialog-tab .rcl-table {
    background: #030303;
    border: none !important;
    border-radius: 3px;
    box-shadow: var(--tbl-metal-edge);
    gap: var(--tbl-gap);
    overflow: visible;
    padding: var(--tbl-gap);
}

#rcl-office .rcl-table__border,
#rcl-office .rcl-table__border-row-right .rcl-table__cell:not(:last-child),
#rcl-office .rcl-table__border-row-bottom .rcl-table__row:not(.rcl-table__row-header):not(:last-child),
.ssi-modalContent .rcl-table__border,
.ssi-modalContent .rcl-table__border-row-right .rcl-table__cell:not(:last-child),
.ssi-modalContent .rcl-table__border-row-bottom .rcl-table__row:not(.rcl-table__row-header):not(:last-child),
.rcl-dialog-tab .rcl-table__border,
.rcl-dialog-tab .rcl-table__border-row-right .rcl-table__cell:not(:last-child),
.rcl-dialog-tab .rcl-table__border-row-bottom .rcl-table__row:not(.rcl-table__row-header):not(:last-child) {
    border: none !important;
}

#rcl-office .rcl-table__row-header,
.ssi-modalContent .rcl-table__row-header,
.rcl-dialog-tab .rcl-table__row-header {
    background: var(--tbl-metal-head) !important;
    border: none !important;
    border-radius: 2px !important;
    box-shadow: var(--tbl-metal-edge) !important;
    color: #dce4ec !important;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    margin-bottom: var(--tbl-gap);
    min-height: 2.5em;
    text-transform: uppercase;
}

#rcl-office .rcl-table__row-header .rcl-table__cell,
.ssi-modalContent .rcl-table__row-header .rcl-table__cell,
.rcl-dialog-tab .rcl-table__row-header .rcl-table__cell {
    border: none !important;
    box-shadow: none !important;
}

#rcl-office .rcl-table__row:not(.rcl-table__row-header),
.ssi-modalContent .rcl-table__row:not(.rcl-table__row-header),
.rcl-dialog-tab .rcl-table__row:not(.rcl-table__row-header) {
    background: var(--tbl-metal-row) !important;
    border: none !important;
    border-radius: 2px !important;
    box-shadow: var(--tbl-metal-edge) !important;
    margin-bottom: var(--tbl-gap);
    transition: box-shadow 0.2s ease;
}

#rcl-office .rcl-table__zebra .rcl-table__row:not(.rcl-table__row-header):nth-child(even),
#rcl-office .rcl-table__row:not(.rcl-table__row-header):nth-child(even),
.ssi-modalContent .rcl-table__zebra .rcl-table__row:not(.rcl-table__row-header):nth-child(even),
.ssi-modalContent .rcl-table__row:not(.rcl-table__row-header):nth-child(even),
.rcl-dialog-tab .rcl-table__zebra .rcl-table__row:not(.rcl-table__row-header):nth-child(even),
.rcl-dialog-tab .rcl-table__row:not(.rcl-table__row-header):nth-child(even) {
    background: var(--tbl-metal-row-alt) !important;
}

#rcl-office .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell,
.ssi-modalContent .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell,
.rcl-dialog-tab .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell {
    border: none !important;
    box-shadow: none !important;
    color: var(--maintext, #fff);
}

#rcl-office .rcl-table__row:not(.rcl-table__row-header):hover,
.ssi-modalContent .rcl-table__row:not(.rcl-table__row-header):hover,
.rcl-dialog-tab .rcl-table__row:not(.rcl-table__row-header):hover {
    box-shadow: var(--tbl-metal-hover) !important;
}

#rcl-office .rcl-table__cell-must-sort,
.ssi-modalContent .rcl-table__cell-must-sort,
.rcl-dialog-tab .rcl-table__cell-must-sort {
    text-decoration: none !important;
}

/* =============================================
   ТИП B — HTML data table — B02
   ============================================= */

#rcl-office table,
.ssi-modalContent table,
.rcl-dialog-tab table,
.entry-content table.bld-tasks-table {
    border-collapse: separate;
    border-spacing: 0 var(--tbl-row-gap);
    width: 100%;
}

#rcl-office table thead th,
#rcl-office table > tr:first-child th,
.ssi-modalContent table thead th,
.ssi-modalContent table > tr:first-child th,
.rcl-dialog-tab table thead th,
.rcl-dialog-tab table > tr:first-child th,
.entry-content table.bld-tasks-table thead th {
    background: var(--tbl-metal-head) !important;
    border: none !important;
    border-radius: 2px !important;
    box-shadow: var(--tbl-metal-edge) !important;
    color: #dce4ec !important;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 9px 12px;
    text-transform: uppercase;
}

#rcl-office table tbody tr,
#rcl-office table tfoot tr,
#rcl-office table > tr:not(:first-child),
.ssi-modalContent table tbody tr,
.ssi-modalContent table tfoot tr,
.ssi-modalContent table > tr:not(:first-child),
.rcl-dialog-tab table tbody tr,
.rcl-dialog-tab table tfoot tr,
.rcl-dialog-tab table > tr:not(:first-child),
.entry-content table.bld-tasks-table tbody tr {
    border: none !important;
    border-radius: 2px !important;
    box-shadow: var(--tbl-metal-edge) !important;
    transition: box-shadow 0.2s ease;
}

#rcl-office table tbody td,
#rcl-office table tfoot td,
#rcl-office table > tr:not(:first-child) td,
.ssi-modalContent table tbody td,
.ssi-modalContent table tfoot td,
.ssi-modalContent table > tr:not(:first-child) td,
.rcl-dialog-tab table tbody td,
.rcl-dialog-tab table tfoot td,
.rcl-dialog-tab table > tr:not(:first-child) td,
.entry-content table.bld-tasks-table tbody td {
    background: var(--tbl-metal-row) !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--maintext, #fff);
    padding: 9px 12px;
    vertical-align: middle;
}

#rcl-office table tbody tr:nth-child(even) td,
#rcl-office table > tr:nth-child(even):not(:first-child) td,
.ssi-modalContent table tbody tr:nth-child(even) td,
.ssi-modalContent table > tr:nth-child(even):not(:first-child) td,
.rcl-dialog-tab table tbody tr:nth-child(even) td,
.rcl-dialog-tab table > tr:nth-child(even):not(:first-child) td,
.entry-content table.bld-tasks-table tbody tr:nth-child(even) td {
    background: var(--tbl-metal-row-alt) !important;
}

#rcl-office table tbody td:first-child,
#rcl-office table > tr:not(:first-child) td:first-child,
.ssi-modalContent table tbody td:first-child,
.ssi-modalContent table > tr:not(:first-child) td:first-child,
.rcl-dialog-tab table tbody td:first-child,
.rcl-dialog-tab table > tr:not(:first-child) td:first-child,
.entry-content table.bld-tasks-table tbody td:first-child {
    border-radius: 2px 0 0 2px;
}

#rcl-office table tbody td:last-child,
#rcl-office table > tr:not(:first-child) td:last-child,
.ssi-modalContent table tbody td:last-child,
.ssi-modalContent table > tr:not(:first-child) td:last-child,
.rcl-dialog-tab table tbody td:last-child,
.rcl-dialog-tab table > tr:not(:first-child) td:last-child,
.entry-content table.bld-tasks-table tbody td:last-child {
    border-radius: 0 2px 2px 0;
}

#rcl-office table tbody tr:hover,
#rcl-office table > tr:not(:first-child):hover,
.ssi-modalContent table tbody tr:hover,
.ssi-modalContent table > tr:not(:first-child):hover,
.rcl-dialog-tab table tbody tr:hover,
.rcl-dialog-tab table > tr:not(:first-child):hover,
.entry-content table.bld-tasks-table tbody tr:hover {
    box-shadow: var(--tbl-metal-hover) !important;
}

#rcl-office .fngassets-portfolio-total td,
.ssi-modalContent .fngassets-portfolio-total td,
.rcl-dialog-tab .fngassets-portfolio-total td {
    background: var(--tbl-metal-label) !important;
    font-weight: 600;
    text-align: right;
}

.entry-content table.bld-tasks-table a.bld-task-link {
    text-decoration: none !important;
}

.entry-content table.bld-tasks-table a.bld-task-link:hover {
    color: var(--links, #dbb300);
    text-decoration: none !important;
}

/* =============================================
   ТИП C — Flex list — C03
   ============================================= */

#rcl-office .fng-task-list,
#rcl-office .fng-request-history,
.ssi-modalContent .fng-task-list,
.ssi-modalContent .fng-request-history,
.rcl-dialog-tab .fng-task-list,
.rcl-dialog-tab .fng-request-history {
    background: #030303;
    border: none;
    border-radius: 3px;
    box-shadow: var(--tbl-metal-edge);
    display: flex;
    flex-direction: column;
    gap: var(--tbl-gap);
    padding: var(--tbl-gap);
}

#rcl-office .fng-task-list .fng-task,
#rcl-office .fng-request-history .fng-task,
.ssi-modalContent .fng-task-list .fng-task,
.ssi-modalContent .fng-request-history .fng-task,
.rcl-dialog-tab .fng-task-list .fng-task,
.rcl-dialog-tab .fng-request-history .fng-task {
    display: flex;
    margin: 0 !important;
}

#rcl-office .fng-task-list > .fng-task:first-child,
#rcl-office .fng-request-history > .fng-task:first-child,
.ssi-modalContent .fng-task-list > .fng-task:first-child,
.ssi-modalContent .fng-request-history > .fng-task:first-child,
.rcl-dialog-tab .fng-task-list > .fng-task:first-child,
.rcl-dialog-tab .fng-request-history > .fng-task:first-child {
    background: var(--tbl-metal-head) !important;
    border: none !important;
    border-radius: 2px !important;
    box-shadow: var(--tbl-metal-edge) !important;
    color: #dce4ec !important;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 12px 14px !important;
    text-align: center;
    text-transform: uppercase;
}

#rcl-office .fng-task-list > .fng-task:not(:first-child),
#rcl-office .fng-request-history > .fng-task:not(:first-child),
.ssi-modalContent .fng-task-list > .fng-task:not(:first-child),
.ssi-modalContent .fng-request-history > .fng-task:not(:first-child),
.rcl-dialog-tab .fng-task-list > .fng-task:not(:first-child),
.rcl-dialog-tab .fng-request-history > .fng-task:not(:first-child) {
    background: var(--tbl-metal-row) !important;
    border: none !important;
    border-radius: 2px !important;
    box-shadow: var(--tbl-metal-edge) !important;
    padding: 11px 14px !important;
    transition: box-shadow 0.2s ease;
}

#rcl-office .fng-task-list > .fng-task:not(:first-child):nth-child(even),
#rcl-office .fng-request-history > .fng-task:not(:first-child):nth-child(even),
.ssi-modalContent .fng-task-list > .fng-task:not(:first-child):nth-child(even),
.ssi-modalContent .fng-request-history > .fng-task:not(:first-child):nth-child(even),
.rcl-dialog-tab .fng-task-list > .fng-task:not(:first-child):nth-child(even),
.rcl-dialog-tab .fng-request-history > .fng-task:not(:first-child):nth-child(even) {
    background: var(--tbl-metal-row-alt) !important;
}

#rcl-office .fng-task-list > .fng-task:not(:first-child):hover,
#rcl-office .fng-request-history > .fng-task:not(:first-child):hover,
.ssi-modalContent .fng-task-list > .fng-task:not(:first-child):hover,
.ssi-modalContent .fng-request-history > .fng-task:not(:first-child):hover,
.rcl-dialog-tab .fng-task-list > .fng-task:not(:first-child):hover,
.rcl-dialog-tab .fng-request-history > .fng-task:not(:first-child):hover {
    box-shadow: var(--tbl-metal-hover) !important;
}

#rcl-office .fng-task-list .task-meta,
#rcl-office .fng-request-history .task-meta,
.ssi-modalContent .fng-task-list .task-meta,
.ssi-modalContent .fng-request-history .task-meta,
.rcl-dialog-tab .fng-task-list .task-meta,
.rcl-dialog-tab .fng-request-history .task-meta {
    border-right: 1px solid rgba(0, 0, 0, 0.35) !important;
    margin-right: 6px;
    padding: 0 8px;
}

#rcl-office .fng-task-list .task-meta:nth-child(1),
.ssi-modalContent .fng-task-list .task-meta:nth-child(1),
.rcl-dialog-tab .fng-task-list .task-meta:nth-child(1) {
    width: 50%;
}

#rcl-office .fng-task-list .task-meta:nth-child(2),
.ssi-modalContent .fng-task-list .task-meta:nth-child(2),
.rcl-dialog-tab .fng-task-list .task-meta:nth-child(2) {
    text-align: center;
    width: 20%;
}

#rcl-office .fng-task-list .task-meta:last-child,
.ssi-modalContent .fng-task-list .task-meta:last-child,
.rcl-dialog-tab .fng-task-list .task-meta:last-child {
    border-right: none !important;
    margin-right: 0;
    text-align: center;
    width: 30%;
}

#rcl-office .fng-request-history .task-meta:nth-child(1),
.ssi-modalContent .fng-request-history .task-meta:nth-child(1),
.rcl-dialog-tab .fng-request-history .task-meta:nth-child(1) {
    width: 60%;
}

#rcl-office .fng-request-history .task-meta:last-child,
.ssi-modalContent .fng-request-history .task-meta:last-child,
.rcl-dialog-tab .fng-request-history .task-meta:last-child {
    border-right: none !important;
    margin-right: 0;
    text-align: center;
    width: 30%;
}

/* =============================================
   ТИП D — Form layout table — D04
   (не .rcl-public-box — форма сделки)
   ============================================= */

#rcl-office .rcl-form table,
.ssi-modalContent .rcl-form table,
.rcl-dialog-tab .rcl-form table {
    border-collapse: separate;
    border-spacing: 0 var(--tbl-row-gap);
}

#rcl-office .rcl-form tbody tr,
.ssi-modalContent .rcl-form tbody tr,
.rcl-dialog-tab .rcl-form tbody tr {
    border: none !important;
    box-shadow: var(--tbl-metal-edge) !important;
    transition: box-shadow 0.2s ease;
}

#rcl-office .rcl-form tbody tr:hover,
.ssi-modalContent .rcl-form tbody tr:hover,
.rcl-dialog-tab .rcl-form tbody tr:hover {
    box-shadow: var(--tbl-metal-hover) !important;
}

#rcl-office .rcl-form th,
.ssi-modalContent .rcl-form th,
.rcl-dialog-tab .rcl-form th {
    background: var(--tbl-metal-label) !important;
    border: none !important;
    border-radius: 2px 0 0 2px !important;
    box-shadow: none !important;
    color: #c8d0d8 !important;
    font-weight: 600;
    padding: 9px 12px;
    vertical-align: middle;
    width: 28%;
}

#rcl-office .rcl-form td,
.ssi-modalContent .rcl-form td,
.rcl-dialog-tab .rcl-form td {
    background: var(--tbl-metal-row) !important;
    border: none !important;
    border-radius: 0 2px 2px 0 !important;
    box-shadow: none !important;
    color: var(--maintext, #fff);
    padding: 9px 12px;
    vertical-align: middle;
}

#rcl-office .rcl-form tbody tr:nth-child(even) td,
.ssi-modalContent .rcl-form tbody tr:nth-child(even) td,
.rcl-dialog-tab .rcl-form tbody tr:nth-child(even) td {
    background: var(--tbl-metal-row-alt) !important;
}

#rcl-office .rcl-form td input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
#rcl-office .rcl-form td textarea,
#rcl-office .rcl-form td select,
.ssi-modalContent .rcl-form td input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.ssi-modalContent .rcl-form td textarea,
.ssi-modalContent .rcl-form td select,
.rcl-dialog-tab .rcl-form td input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.rcl-dialog-tab .rcl-form td textarea,
.rcl-dialog-tab .rcl-form td select {
    box-shadow: var(--tbl-metal-edge);
}

/* =============================================
   ИСКЛЮЧЕНИЕ: форма сделки / .rcl-public-box
   ============================================= */

#rcl-office .rcl-public-box .rcl-form table {
    border-collapse: collapse;
    border-spacing: 0;
}

#rcl-office .rcl-public-box .rcl-form tbody tr {
    background: transparent;
    box-shadow: none !important;
}

#rcl-office .rcl-public-box .rcl-form tbody tr:hover {
    box-shadow: none !important;
}

#rcl-office .rcl-public-box .rcl-form th,
#rcl-office .rcl-public-box .rcl-form td {
    background: transparent !important;
    border-color: #444 !important;
    border-radius: 0 !important;
    border-style: solid;
    border-width: 0;
    box-shadow: none !important;
    color: var(--maintext, #fff);
    font-size: inherit;
    letter-spacing: normal;
    text-transform: none;
    width: auto;
}

#rcl-office .rcl-public-box .rcl-form tr {
    background: #1a1a1a;
}

#rcl-office .rcl-public-box .rcl-form tr th {
    background-color: #2a2a2a !important;
}

#rcl-office .rcl-public-box table {
    border-collapse: collapse;
    border-spacing: 0;
}

#rcl-office .rcl-public-box table thead th,
#rcl-office .rcl-public-box table tbody tr,
#rcl-office .rcl-public-box table tbody td {
    background: transparent !important;
    box-shadow: none !important;
    font-size: inherit;
    letter-spacing: normal;
    text-transform: none;
}

/* Semantic diff rows (fng-addagreement) — поверх B02 */

#rcl-office .fngagr-diff-table tr.row-added td,
.ssi-modalContent .fngagr-diff-table tr.row-added td,
.rcl-dialog-tab .fngagr-diff-table tr.row-added td {
    background: rgba(64, 138, 92, 0.14) !important;
}

#rcl-office .fngagr-diff-table tr.row-removed td,
.ssi-modalContent .fngagr-diff-table tr.row-removed td,
.rcl-dialog-tab .fngagr-diff-table tr.row-removed td {
    background: rgba(179, 72, 62, 0.14) !important;
}

#rcl-office .fngagr-diff-table tr.row-changed td,
.ssi-modalContent .fngagr-diff-table tr.row-changed td,
.rcl-dialog-tab .fngagr-diff-table tr.row-changed td {
    background: rgba(138, 125, 43, 0.1) !important;
}

/* =============================================
   Mobile — card mode для A и B
   ============================================= */

@media (max-width: 768px) {
    #rcl-office .rcl-table__row-header,
    .ssi-modalContent .rcl-table__row-header,
    .rcl-dialog-tab .rcl-table__row-header {
        display: none;
    }

    #rcl-office .rcl-table__row:not(.rcl-table__row-header),
    .ssi-modalContent .rcl-table__row:not(.rcl-table__row-header),
    .rcl-dialog-tab .rcl-table__row:not(.rcl-table__row-header) {
        flex-direction: column;
        padding: 10px;
    }

    #rcl-office .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell,
    .ssi-modalContent .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell,
    .rcl-dialog-tab .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell {
        justify-content: space-between;
        max-width: none !important;
        padding: 5px 0;
    }

    #rcl-office .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell::before,
    .ssi-modalContent .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell::before,
    .rcl-dialog-tab .rcl-table__row:not(.rcl-table__row-header) .rcl-table__cell::before {
        color: #8a929a;
        content: attr(data-rcl-ttitle);
        font-size: 10px;
        letter-spacing: 0.06em;
        margin-right: 10px;
        text-transform: uppercase;
    }

    #rcl-office table thead,
    .ssi-modalContent table thead,
    .rcl-dialog-tab table thead {
        display: none;
    }

    #rcl-office .rcl-public-box table thead {
        display: table-header-group;
    }

    #rcl-office table tbody tr,
    #rcl-office table > tr:not(:first-child),
    .ssi-modalContent table tbody tr,
    .ssi-modalContent table > tr:not(:first-child),
    .rcl-dialog-tab table tbody tr,
    .rcl-dialog-tab table > tr:not(:first-child),
    .entry-content table.bld-tasks-table tbody tr {
        display: block;
        padding: 10px;
    }

    #rcl-office table > tr:first-child {
        display: none;
    }

    #rcl-office table tbody td,
    #rcl-office table > tr:not(:first-child) td,
    .ssi-modalContent table tbody td,
    .ssi-modalContent table > tr:not(:first-child) td,
    .rcl-dialog-tab table tbody td,
    .rcl-dialog-tab table > tr:not(:first-child) td,
    .entry-content table.bld-tasks-table tbody td {
        border-radius: 0 !important;
        display: flex;
        justify-content: space-between;
        padding: 5px 0;
    }

    #rcl-office .fng-task-list .fng-task,
    #rcl-office .fng-request-history .fng-task,
    .ssi-modalContent .fng-task-list .fng-task,
    .rcl-dialog-tab .fng-task-list .fng-task {
        flex-wrap: wrap;
    }

    #rcl-office .fng-task-list .task-meta,
    #rcl-office .fng-request-history .task-meta,
    .ssi-modalContent .fng-task-list .task-meta,
    .rcl-dialog-tab .fng-task-list .task-meta {
        border-right: none !important;
        margin-bottom: 4px;
        width: 100% !important;
    }
}
