/* ==== Dashboard-раскладка OKO ==== */

* { box-sizing: border-box; }

body.dash {
    display: flex;
    min-height: 100vh;
    margin: 0;
    background: #f0f4fb;
}

/* --- Боковая панель --- */
#sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #1c3d5a 0%, #16324a 100%);
    color: #ffffff;
    z-index: 100;
    overflow-y: auto;
}

#sidebar .logo_box {
    display: block;
    height: 64px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

/* Логотип ОКО (картинка из оригинального дизайна) */
#logo {
    display: block;
    width: 100%;
    max-width: 165px;
    height: 46px;
    box-sizing: border-box;
}

#logo > span {
    display: block;
    width: 100%;
    height: 100%;
    background: url(../images/logo.png);
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.side_scroll {
    flex: 1;
    padding: 10px 0 16px;
}

.side_group {
    padding: 14px 18px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7f9cb8;
}

.side_nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: #cfe0f5;
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.side_nav a:hover {
    background: rgba(111, 168, 255, 0.12);
    color: #ffffff;
}

.side_nav a.active {
    background: rgba(111, 168, 255, 0.18);
    border-left-color: #6fa8ff;
    color: #ffffff;
    font-weight: bold;
}

.side_nav a .material-icons {
    font-size: 19px;
    color: #8dbaff;
    flex-shrink: 0;
}

.side_footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 18px 14px;
    font-size: 13px;
}

.side_footer .side_user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    text-decoration: none;
    margin-bottom: 6px;
    word-break: break-all;
}

.side_footer .side_user .material-icons {
    font-size: 20px;
    color: #8dbaff;
}

.side_footer a.logout_link {
    color: #ffb0b0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.side_footer a.logout_link:hover { text-decoration: underline; }

.side_footer .auth_links a {
    color: #cfe0f5;
    text-decoration: none;
    margin-right: 10px;
}

.side_footer .auth_links a:hover { color: #ffffff; }

/* --- Основная область --- */
#main_area {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e3ebf7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

#topbar .page_title {
    font-size: 19px;
    font-weight: bold;
    color: #1c3d5a;
    margin: 0;
}

#topbar .topbar_right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12.5px;
    color: #667;
    white-space: nowrap;
}

#topbar .user_chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef5ff;
    border: 1px solid #d4e3ff;
    border-radius: 999px;
    padding: 5px 14px;
    color: #2f66c4;
    font-weight: bold;
    text-decoration: none;
}

#content_area {
    flex: 1;
    padding: 24px 28px 60px;
}

/* --- Карточки дашборда --- */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}

.dash-card {
    background: #ffffff;
    border: 1px solid #e3ebf7;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(80, 120, 200, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dash-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(80, 120, 200, 0.16);
}

.dash-card .card_top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.dash-card .card_label {
    font-size: 13px;
    color: #557;
}

.dash-card .card_icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #eaf3ff 0%, #dcebff 100%);
}

.dash-card .card_icon .material-icons {
    color: #2f66c4;
    font-size: 21px;
}

.dash-card .card_value {
    font-size: 27px;
    font-weight: bold;
    color: #1c3d5a;
}

.dash-card .card_sub {
    margin-top: 4px;
    font-size: 12px;
    color: #88a;
}

.dash-card.accent-blue   { border-top: 3px solid #6fa8ff; }
.dash-card.accent-red    { border-top: 3px solid #ef7d7d; }
.dash-card.accent-green  { border-top: 3px solid #63c98a; }
.dash-card.accent-yellow { border-top: 3px solid #f2c14e; }
.dash-card.accent-violet { border-top: 3px solid #9b8cf2; }

a.dash-card {
    text-decoration: none;
    display: block;
}

a.dash-card:hover .card_value { color: #2f66c4; }

/* --- Панели с таблицами/списками на дашборде --- */
.dash-panel {
    background: #ffffff;
    border: 1px solid #e3ebf7;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(80, 120, 200, 0.08);
    margin-bottom: 22px;
    overflow: hidden;
}

.dash-panel .panel_head {
    padding: 14px 18px;
    border-bottom: 1px solid #edf3fc;
    font-weight: bold;
    color: #1c3d5a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-panel .panel_head .material-icons {
    color: #6fa8ff;
    font-size: 20px;
}

.dash-panel table.original {
    width: 100%;
    box-shadow: none;
    border-radius: 0;
}

/* --- Прогресс-бары для разбивки по типам --- */
.type-row {
    display: grid;
    grid-template-columns: 220px 1fr 90px;
    align-items: center;
    gap: 12px;
    padding: 9px 18px;
    font-size: 13.5px;
    color: #33475f;
}

.type-row:nth-child(even) { background: #f7faff; }

.type-bar {
    height: 10px;
    border-radius: 999px;
    background: #edf3fc;
    overflow: hidden;
}

.type-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #8dbaff 0%, #6fa8ff 100%);
}

.type-row .type_count {
    text-align: right;
    font-weight: bold;
    color: #2f66c4;
}

/* --- Ячейки годов в сводном отчете --- */
a.year-cell {
    display: inline-block;
    min-width: 96px;
    padding: 7px 10px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid #e3ebf7;
    background: #f7faff;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

a.year-cell:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(80, 120, 200, 0.18);
}

a.year-cell.has-errors {
    border-color: #f5bcbc;
    background: #fff6f6;
}

a.year-cell.has-errors:hover { border-color: #ef7d7d; }

a.year-cell.no-errors {
    border-color: #cdeed8;
    background: #f6fcf8;
}

.year-cell .year-num {
    display: block;
    font-size: 17px;
    font-weight: bold;
    color: #63c98a;
}

.year-cell.has-errors .year-num { color: #d9534f; }

.year-cell .year-label {
    display: block;
    font-size: 11px;
    color: #667;
}

.year-cell .year-sum {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #946a00;
}

/* Ячейки СГОЗ — синяя палитра */
a.year-cell.sgoz-cell {
    border-color: #d4e3ff;
    background: linear-gradient(160deg, #ffffff 0%, #eef5ff 100%);
    min-width: 110px;
}

a.year-cell.sgoz-cell:hover { border-color: #6fa8ff; }

a.year-cell.sgoz-cell .year-num {
    color: #2f66c4;
    font-size: 14px;
}

/* Кнопка нарушений в ячейке СГОЗ */
a.sgoz-errors-toggle {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: bold;
    text-decoration: none;
    color: #b02a2a;
    background: linear-gradient(180deg, #fdeeee 0%, #fbdedd 100%);
    border: 1px solid #f0c3c3;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

a.sgoz-errors-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(217, 83, 79, 0.25);
    filter: brightness(1.03);
}

a.sgoz-errors-toggle.expanded {
    outline: 2px solid #ef7d7d;
    outline-offset: -1px;
}

.total-cell {
    background: #eef5ff !important;
    font-weight: bold;
    color: #1c3d5a;
}

/* --- Чип "Всего нарушений" в шапке отчета --- */
.total-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fdeeee;
    border: 1px solid #f5bcbc;
    color: #b02a2a;
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 12.5px;
    font-weight: normal;
    margin-left: 10px;
    white-space: nowrap;
}

.total-chip .material-icons { color: #d9534f; }

/* --- Раскрывающаяся сводка рисков --- */
a.year-cell.js-errors-toggle.has-errors {
    cursor: pointer;
    position: relative;
}

a.year-cell.js-errors-toggle.has-errors::after {
    content: '▾';
    position: absolute;
    right: 6px;
    bottom: 2px;
    font-size: 11px;
    color: #d9534f;
}

a.year-cell.js-errors-toggle.expanded::after { content: '▴'; }

a.year-cell.expanded {
    outline: 2px solid #6fa8ff;
    outline-offset: -1px;
}

.errors-detail-row > td {
    padding: 0 !important;
    background: transparent !important;
}

.errors-detail-box {
    margin: 4px 8px 12px 24px;
    border: 1px solid #e3ebf7;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(80, 120, 200, 0.08);
}

.errors-detail-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: linear-gradient(180deg, #fff6f6 0%, #ffffff 100%);
    border-bottom: 1px solid #f5e0e0;
    font-size: 14px;
    color: #1c3d5a;
}

.errors-detail-head .material-icons {
    color: #d9534f;
    font-size: 19px;
}

.errors-empty {
    padding: 18px;
    text-align: center;
    color: #889;
    font-style: italic;
}

/* --- Таблица нарушений внутри сводки --- */
.errors-table > thead > tr > th {
    background: #f4f8ff !important;
    color: #55708c !important;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.errors-table > tbody > tr:hover > td {
    background-color: #fff8f8 !important;
}

.badge.err-type {
    background: linear-gradient(180deg, #fdeeee 0%, #fbdedd 100%);
    color: #b02a2a;
    border: 1px solid #f0c3c3;
    font-size: 11.5px;
    max-width: 170px;
    white-space: normal;
    line-height: 1.35;
}

.err-text {
    font-size: 13px;
    color: #33475f;
    max-width: 480px;
}

.err-price {
    font-weight: bold;
    color: #946a00;
    white-space: nowrap;
}

/* ==== СГОЗ: компактный список-аккордеон ==== */
.sgoz-list {
    padding: 6px 10px 14px;
}

details.sgoz-card {
    border: 1px solid #e3ebf7;
    border-radius: 12px;
    margin: 10px 8px;
    background: #ffffff;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}

details.sgoz-card[open] {
    box-shadow: 0 4px 14px rgba(80, 120, 200, 0.14);
    border-color: #c9dcff;
}

details.sgoz-card summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background-color 0.12s ease;
}

details.sgoz-card summary::-webkit-details-marker { display: none; }

details.sgoz-card summary:hover { background: #f4f9ff; }

.sgoz-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #eef5ff;
    color: #2f66c4;
    font-weight: bold;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sgoz-name {
    font-weight: bold;
    color: #1c3d5a;
    font-size: 14.5px;
}

.sgoz-inn {
    font-size: 12px;
    color: #889;
}

.sgoz-total {
    margin-left: auto;
    font-weight: bold;
    color: #2f66c4;
    white-space: nowrap;
    font-size: 14.5px;
}

.sgoz-chevron {
    color: #8dbaff;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

details[open] .sgoz-chevron { transform: rotate(180deg); }

.sgoz-card-body {
    border-top: 1px solid #edf3fc;
    padding: 14px 16px 16px;
    background: #fbfdff;
}

/* Годы */
.sgoz-years {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.sgoz-year-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border: 1px dashed #d4e3ff;
    border-radius: 10px;
    background: #ffffff;
}

a.sgoz-year-link {
    text-decoration: none;
    text-align: center;
    transition: transform 0.12s ease;
    display: block;
}

a.sgoz-year-link:hover { transform: translateY(-1px); }

.sgoz-year-label {
    display: block;
    font-size: 11.5px;
    color: #667;
    letter-spacing: 0.5px;
}

.sgoz-year-value {
    display: block;
    font-size: 15px;
    font-weight: bold;
    color: #2f66c4;
}

.sgoz-year-item.empty .sgoz-year-label { margin-bottom: 3px; }

.sgoz-year-errors { align-self: center; }

/* Нарушения — карточки */
.err-group {
    margin-top: 6px;
}

.err-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-weight: bold;
    color: #b02a2a;
    font-size: 13.5px;
    margin: 10px 0;
}

.err-group-head .material-icons {
    font-size: 18px;
    color: #d9534f;
}

.err-open-full { margin-left: auto; }

.err-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.err-card {
    background: #ffffff;
    border: 1px solid #f0dbe0;
    border-left: 4px solid #ef7d7d;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.err-card:hover {
    box-shadow: 0 4px 12px rgba(217, 83, 79, 0.15);
    transform: translateY(-1px);
}

.err-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.err-card-pos {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: bold;
    color: #1c3d5a;
}

.err-card-pos .material-icons {
    font-size: 15px;
    color: #8dbaff;
}

/* ==== Большая таблица отчета: скролл + липкая шапка ==== */
.table-scroll {
    overflow: auto;
    max-height: calc(100vh - 220px);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(80, 120, 200, 0.08);
}

.table-scroll > table.original.pretty {
    margin: 0;
    min-width: 100%;
    font-size: 12.5px;
}

/* шапка */
.table-scroll > table.original.pretty > thead > tr > td {
    position: sticky;
    z-index: 5;
    white-space: nowrap;
    padding: 8px 10px;
    font-weight: bold;
    text-align: center;
    color: #ffffff;
    background: linear-gradient(180deg, #89b2ff 0%, #74a1f0 100%);
    border-color: #6b97dd;
}

.table-scroll > table.original.pretty > thead > tr:first-child > td { top: 0; }
.table-scroll > table.original.pretty > thead > tr:nth-child(2) > td { top: 37px; }
.table-scroll > table.original.pretty > thead > tr:nth-child(3) > td { top: 74px; }

.table-scroll > table.original.pretty > thead > tr:first-child > td.end_group,
.table-scroll > table.original.pretty > thead > tr:nth-child(2) > td.end_group {
    border-right: 2px solid #4d7fd6;
}

/* тело */
.table-scroll > table.original.pretty > tbody > tr > td {
    padding: 5px 8px;
    font-size: 12.5px;
    vertical-align: middle;
}

.table-scroll > table.original.pretty > tbody > tr:nth-child(even) > td {
    background-color: #f7faff;
}

.table-scroll > table.original.pretty > tbody > tr:hover > td {
    background-color: #eaf3ff !important;
}

/* вложенные таблицы-раскрывашки не разъезжаются */
.table-scroll td.inner > table {
    width: auto;
}

/* --- Цветовое кодирование секций шапки --- */
.table-scroll table.original.pretty > thead > tr:first-child > td.grp-risks {
    background: linear-gradient(180deg, #ef8a8a 0%, #d9534f 100%);
    border-color: #c94540;
}

.table-scroll table.original.pretty > thead > tr:first-child > td.grp-plan {
    background: linear-gradient(180deg, #89b2ff 0%, #5f92e8 100%);
    border-color: #4d7fd6;
}

.table-scroll table.original.pretty > thead > tr:first-child > td.grp-notice {
    background: linear-gradient(180deg, #a99df0 0%, #8677e0 100%);
    border-color: #6f5fd1;
}

.table-scroll table.original.pretty > thead > tr:first-child > td.grp-contract {
    background: linear-gradient(180deg, #74cb98 0%, #4caf7d 100%);
    border-color: #3d9668;
}

/* --- Бейдж количества нарушений --- */
a.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, #fdeeee 0%, #fbdedd 100%);
    border: 1px solid #f0b9b9;
    color: #b02a2a;
    font-weight: bold;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

a.risk-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(217, 83, 79, 0.3);
}

.risk-zero {
    color: #63c98a;
    font-weight: bold;
    font-size: 15px;
}

/* --- Поповер со списком нарушений --- */
.error-popover {
    width: 480px !important;
    max-width: 90vw !important;
    text-align: left !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(28, 61, 90, 0.25) !important;
    padding: 14px !important;
    z-index: 60;
}

.error-popover ul.inner {
    margin: 0;
    padding: 0;
    list-style: none;
}

.error-popover ul.inner li {
    background: #fff8f8;
    border-left: 3px solid #ef7d7d;
    border-radius: 8px;
    padding: 9px 12px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #33475f;
}

.error-popover .slide_title {
    display: inline-block;
    background: linear-gradient(180deg, #fdeeee 0%, #fbdedd 100%);
    border: 1px solid #f0b9b9;
    color: #b02a2a;
    font-weight: bold;
    font-size: 11.5px;
    border-radius: 999px;
    padding: 2px 10px;
    margin-bottom: 8px;
}

/* ==== Отчет по позиции: карточки вместо таблицы ==== */
.pos-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

details.pos-card {
    background: #ffffff;
    border: 1px solid #e3ebf7;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

details.pos-card[open] {
    box-shadow: 0 4px 14px rgba(80, 120, 200, 0.14);
    border-color: #c9dcff;
}

details.pos-card summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background-color 0.12s ease;
}

details.pos-card summary::-webkit-details-marker { display: none; }

details.pos-card summary:hover { background: #f4f9ff; }

.pos-num {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #eef5ff;
    color: #2f66c4;
    font-weight: bold;
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pos-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pos-name {
    font-weight: bold;
    color: #1c3d5a;
    font-size: 14.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pos-sub {
    font-size: 11.5px;
    color: #889;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pos-risks { flex-shrink: 0; }

.pos-sum {
    flex-shrink: 0;
    font-weight: bold;
    color: #2f66c4;
    white-space: nowrap;
    font-size: 14.5px;
    min-width: 110px;
    text-align: right;
}

.pos-card-body {
    border-top: 1px solid #edf3fc;
    padding: 16px 18px;
    background: #fbfdff;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Финансовые чипы */
.pos-chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.pos-chip {
    background: #ffffff;
    border: 1px dashed #d4e3ff;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #667;
}

.pos-chip b { color: #2f66c4; white-space: nowrap; }

/* Контракты позиции */
.contract-row {
    background: #ffffff;
    border: 1px solid #d9efe1;
    border-left: 4px solid #63c98a;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contract-row-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13.5px;
    color: #1c3d5a;
}

.contract-row-head .material-icons {
    font-size: 17px;
    color: #4caf7d;
}

.contract-price {
    margin-left: auto;
    font-weight: bold;
    color: #1e7c34;
    white-space: nowrap;
}

.contract-row-dates {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #667;
}

/* Секции внутри карточки позиции */
.card-section {
    background: #ffffff;
    border: 1px solid #e3ebf7;
    border-radius: 10px;
    padding: 12px 14px;
}

.card-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: bold;
    font-size: 13.5px;
    color: #2f66c4;
    margin-bottom: 10px;
}

.card-section-title .material-icons { font-size: 18px; }

.card-section-title.notice { color: #7060d8; }
.card-section-title.notice .material-icons { color: #8677e0; }

.card-section-title.risks { color: #b02a2a; }
.card-section-title.risks .material-icons { color: #d9534f; }

.card-section-title.contract { color: #1e7c34; margin-top: 12px; }
.card-section-title.contract .material-icons { color: #4caf7d; }

.okpd-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* Пары ключ-значение */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px 14px;
}

.kv {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    padding: 5px 0;
    border-bottom: 1px dashed #edf3fc;
}

.kv span { color: #667; white-space: nowrap; }
.kv b {
    color: #1c3d5a;
    text-align: right;
    word-break: break-word;
    max-width: 60%;
}
.kv a { color: #2f66c4; word-break: break-all; }

/* Мини-таблицы номенклатуры */
.mini-table {
    margin-top: 10px;
    font-size: 12px !important;
}

.mini-table > thead > tr > th {
    background: #f4f8ff !important;
    color: #55708c !important;
    font-size: 11.5px !important;
}

/* Полоса платежей */
.pay-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.pos-chip.ok { border-color: #bfe6cd; }
.pos-chip.ok b { color: #1e7c34; }

.pos-chip.warn { border-color: #ffe29a; }
.pos-chip.warn b { color: #946a00; }

/* Индикатор фонового обновления компании */
.updating-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: bold;
    color: #946a00;
    background: #fff3d6;
    border: 1px solid #ffe29a;
    animation: updating-pulse 1.4s ease-in-out infinite;
}

.updating-badge .material-icons {
    font-size: 14px;
    animation: updating-spin 1.6s linear infinite;
}

@keyframes updating-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

@keyframes updating-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.contract-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ==== Карточка контракта ==== */
.ct-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: linear-gradient(160deg, #ffffff 0%, #ebf8f0 100%);
    border: 1px solid #c4e8d2;
    border-radius: 12px;
    padding: 12px 16px;
}

.ct-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(160deg, #74cb98 0%, #4caf7d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ct-icon .material-icons { color: #ffffff; font-size: 24px; }

.ct-main {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ct-number {
    font-weight: bold;
    font-size: 14.5px;
}

.ct-number a {
    color: #1c3d5a;
    text-decoration: none;
    border-bottom: 1px dashed #9db8d4;
}

.ct-number a:hover { color: #2f66c4; border-bottom-color: #2f66c4; }

.ct-sub {
    font-size: 12px;
    color: #889;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ct-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
}

.ct-price span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #889;
}

.ct-price {
    font-size: 17px;
    font-weight: bold;
    color: #1e7c34;
    white-space: nowrap;
}

/* Прогресс исполнения */
.ct-progress {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.ctp-item {
    background: #ffffff;
    border: 1px dashed #cdeed8;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ctp-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #33475f;
}

.ctp-head .material-icons { font-size: 16px; color: #4caf7d; }

.ctp-head b { margin-left: auto; color: #1e7c34; white-space: nowrap; }

.ct-progress .type-bar { height: 8px; }

.ct-progress .type-bar span {
    background: linear-gradient(90deg, #63c98a 0%, #3fae68 100%);
}

/* Реквизиты контракта */
.ct-props .kv .material-icons {
    font-size: 16px;
    color: #4caf7d;
    background: #ebf8f0;
    border-radius: 8px;
    padding: 4px;
    flex-shrink: 0;
}

.penalty-val { color: #b02a2a; }

/* Баннер режима просмотра от лица пользователя */
.impersonate-banner {
    position: sticky;
    top: 64px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: linear-gradient(90deg, #4a3fb5 0%, #7060d8 100%);
    color: #ffffff;
    padding: 9px 18px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 13.5px;
    box-shadow: 0 4px 14px rgba(74, 63, 181, 0.35);
}

.impersonate-banner .material-icons { font-size: 19px; }

.impersonate-banner b { color: #ffd76e; }

.impersonate-banner .btn-mini {
    border-color: rgba(255, 255, 255, 0.5);
}

/* ==== Карточка План-график ==== */
.pg-card {
    border-left: 4px solid #6fa8ff;
}

.pg-sums {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.sum-tile {
    background: linear-gradient(160deg, #ffffff 0%, #eef5ff 100%);
    border: 1px solid #d4e3ff;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sum-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(80, 120, 200, 0.2);
}

.sum-tile.total {
    background: linear-gradient(160deg, #6fa8ff 0%, #4d8bef 100%);
    border-color: #4d8bef;
}

.sum-tile.current {
    border-width: 2px;
    border-color: #89b2ff;
}

.sum-tile .st-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: #55708c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sum-tile .st-label .material-icons { font-size: 14px; }

.sum-tile.total .st-label { color: #dbe9ff; }

.sum-tile .st-value {
    font-size: 17px;
    font-weight: bold;
    color: #1c3d5a;
    white-space: nowrap;
}

.sum-tile.total .st-value { color: #ffffff; }

.st-bar {
    height: 6px;
    background: rgba(111, 168, 255, 0.18);
    border-radius: 999px;
    overflow: hidden;
}

.st-bar span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #8dbaff 0%, #4d8bef 100%);
}

/* ==== Карточка Извещение ==== */
.izv-card {
    border-left: 4px solid #8677e0;
}

.izv-head {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: linear-gradient(160deg, #f3f1ff 0%, #eae7ff 100%);
    border: 1px solid #ddd8ff;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.izv-nmck {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 16px;
    border-right: 1px solid #d5cffa;
}

.izv-nmck-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7060d8;
}

.izv-nmck-value {
    font-size: 20px;
    font-weight: bold;
    color: #4a3fb5;
    white-space: nowrap;
}

.izv-name {
    flex: 1;
    min-width: 200px;
    font-size: 14px;
    font-weight: bold;
    color: #1c3d5a;
}

.kv-grid .kv {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed #edf3fc;
}

.kv-grid .kv .material-icons {
    font-size: 17px;
    color: #8677e0;
    background: #f3f1ff;
    border-radius: 8px;
    padding: 4px;
    flex-shrink: 0;
}

.kv-grid .kv div {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

/* Просроченные строки в контроле сроков */
tr.overdue-row > td {
    background-color: #fff6f6 !important;
}

tr.overdue-row:hover > td {
    background-color: #fdeeee !important;
}

.subject-cell {
    max-width: 340px;
    font-size: 12.5px;
    color: #33475f;
}

/* Фильтр "только с ошибками" */
.pos-list.only-risks details.pos-card:not(.has-risks) {
    display: none;
}

/* ==== Сайдбар: сворачивание до иконок ==== */
body.side-collapsed #sidebar { width: 68px; }

body.side-collapsed #sidebar #logo,
body.side-collapsed #sidebar .side_nav a span,
body.side-collapsed #sidebar .side_group {
    display: none;
}

body.side-collapsed #sidebar .logo_box { justify-content: center; padding: 12px 0; }

body.side-collapsed #sidebar .side_nav a {
    justify-content: center;
    padding: 11px 0;
    position: relative;
}

body.side-collapsed #sidebar .side_footer { padding: 10px 6px 14px; text-align: center; }

body.side-collapsed #sidebar .side_user span,
body.side-collapsed #sidebar .logout_link { display: none; }

body.side-collapsed #main_area { margin-left: 68px; }

#collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #8dbaff;
    padding: 4px;
    margin-right: 2px;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}

#collapse-btn:hover { background: rgba(111, 168, 255, 0.15); }

/* ==== Страница входа ==== */
.login-wrap {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
    padding-top: 20px;
}

.login-card {
    width: 400px;
    max-width: 94vw;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(28, 61, 90, 0.16);
    padding: 34px 34px 28px;
}

.login-card .login-logo {
    text-align: center;
    font-size: 30px;
    font-weight: bold;
    color: #1c3d5a;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.login-card .login-logo span { color: #6fa8ff; }

.login-card .login-sub {
    text-align: center;
    font-size: 13.5px;
    color: #667;
    margin-bottom: 22px;
}

.login-card p {
    margin: 0 0 14px;
}

.login-card label {
    display: block;
    font-size: 13px;
    color: #55708c;
    margin-bottom: 5px;
    font-weight: bold;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #c4d6f5;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
    border-color: #6fa8ff;
    box-shadow: 0 0 0 3px rgba(111, 168, 255, 0.25);
}

.login-card input.errorlist ~ input,
.login-card .errorlist {
    color: #b02a2a;
    font-size: 12.5px;
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
}

.login-card .show-pass {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #557;
    margin-bottom: 16px;
    cursor: pointer;
}

.login-card .login-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #8dbaff 0%, #6fa8ff 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.login-card .login-submit:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(80, 120, 200, 0.3);
}

.login-contacts {
    width: 320px;
    max-width: 90vw;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #e3ebf7;
    border-radius: 14px;
    padding: 20px 24px;
    font-size: 13.5px;
    color: #33475f;
    line-height: 1.9;
}

.login-contacts b { color: #1c3d5a; }

.login-contacts a {
    color: #2f66c4;
    text-decoration: none;
    font-weight: bold;
}

.login-contacts a:hover { text-decoration: underline; }

/* Витрина возможностей на странице входа */
.login-features {
    width: 620px;
    max-width: 94vw;
}

.lf-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: bold;
    color: #1c3d5a;
    margin-bottom: 14px;
}

.lf-title .material-icons { color: #6fa8ff; }

.lf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 12px;
}

.lf-card {
    background: #ffffff;
    border: 1px solid #e3ebf7;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(80, 120, 200, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.lf-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(80, 120, 200, 0.18);
    border-color: #bcd4ff;
}

.lf-card .material-icons {
    color: #6fa8ff;
    font-size: 24px;
}

.lf-card b {
    color: #1c3d5a;
    font-size: 13.5px;
}

.lf-card span {
    font-size: 12.5px;
    color: #667;
    line-height: 1.45;
}

.lf-note {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eef5ff;
    border: 1px solid #d4e3ff;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #2f66c4;
}

.lf-note .material-icons { font-size: 18px; color: #6fa8ff; }

@media (max-width: 900px) {
    #sidebar { width: 68px; }
    #logo,
    #sidebar .side_nav a span,
    #sidebar .side_group,
    #sidebar .side_user span,
    #main_area { margin-left: 68px; }
}

/* Метка модуля в разработке */
.side_nav a.dev-link { opacity: 0.55; }

.dev-mark {
    display: inline-block;
    font-style: normal;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #ffb648;
    color: #4a3200;
    border-radius: 999px;
    padding: 1px 7px;
    margin-left: 6px;
    vertical-align: 1px;
}
