/* ================================
   DASHBOARD GRID
================================ */

#dashboard {
    display: grid;
    min-width: 600px;
    grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
    grid-auto-rows: minmax(360px, auto);
    gap: 10px;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ================================
   CARDS
================================ */

.dash-card {
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    background: #ffffff;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
}

.dash-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.dash-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.dash-total {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0 18px;
}

.positive { color: #047857; }
.negative { color: #b91c1c; }

/* ================================
   TABLES
================================ */

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.dash-table tr {
    border-bottom: 1px solid #eee;
}

.dash-table td {
    padding: 6px 4px;
}

.dash-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.dash-table.inner {
    margin-top: 6px;
    background: #fafafa;
}

/* ================================
   HISTOGRAM
================================ */

.dash-histogram {
    margin-top: 14px;
    flex: 1;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 6px;
    min-height: 160px;
}

.hist-y {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 11px;
    color: #6b7280;
    padding-bottom: 18px;
}

.hist-plot {
    position: relative;
    display: flex;
    gap: 10px;
    border-left: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding-left: 10px;
    padding-bottom: 26px;
}

.hist-plot::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, #e5e7eb 1px, transparent 1px);
    background-size: 100% 25%;
    pointer-events: none;
}

/* ================================
   COLUMNS
================================ */

.hist-col {
    flex: 1;
    position: relative;
}

/* СТОЛБЕЦ */
.hist-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    /* 👇 ВАЖНО */
    color: #111827;               /* тёмный текст */
    font-size: 11px;
    font-weight: 600;

    border-radius: 4px 4px 0 0;
    padding-bottom: 4px;

    /* плашка под текстом */
    background-clip: padding-box;
}

/* ПЛАШКА ПОД ЧИСЛОМ */
.hist-bar::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 2px;
    height: 16px;

    background: rgba(255,255,255,0.75);
    border-radius: 4px;
    z-index: -1;
}

/* ================================
   CURRENT MONTH (ПОСЛЕДНИЙ)
================================ */

.hist-col:last-child .hist-bar {
    color: #0f172a;
}

.hist-col:last-child .hist-bar::after {
    background: rgba(255,255,255,0.85);
}

/* ================================
   MONTH LABELS
================================ */

.hist-col > div:last-child {
    position: absolute;
    bottom: -22px;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: #6b7280;
}

/* ================================
   ANIMATION
================================ */

.hist-bar {
    transform-origin: bottom;
    transform: scaleY(0);
    transition: transform 1s ease-out;
}

.hist-bar.animate {
    transform: scaleY(1);
}

/* ================================
   LIABILITIES
================================ */

.liab-cat {
    cursor: pointer;
}

.liab-cat:hover {
    background: #f1f5f9;
}

.liab-item {
    cursor: pointer;
}

.liab-item:hover {
    background: #eef2ff;
}


/* =====================================
   ВЫРАВНИВАНИЕ ЗАГОЛОВКОВ КАК У ЧИСЕЛ
===================================== */

/* все числовые колонки — вправо */
.liab-table th:nth-child(n+2),
.liab-table td:nth-child(n+2),
.salary-table th:nth-child(n+2),
.salary-table td:nth-child(n+2) {
    text-align: right;
}

/* первая колонка (Період / Місяць) — влево */
.liab-table th:first-child,
.liab-table td:first-child,
.salary-table th:first-child,
.salary-table td:first-child {
    text-align: left;
}
.salary-table thead th:nth-child(n+2),
.liab-table thead th:nth-child(n+2) {
    border-bottom: 2px solid #d1d5db;
}

/* Контейнер услуг */
.liab-what-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-top: 4px;
}

/* label = визуальный тег */
.liab-what-list label {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;

    background: #f2f4f7;
    border: 1px solid #d0d7de;
    color: #333;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

/* скрываем реальный checkbox */
.liab-what-list input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* hover */
.liab-what-list label:hover {
    background: #e8edf5;
    border-color: #94a3b8;
}
.liab-what-list label:hover span {
    color: #374151;          /* чуть темнее серого */
}

/* активное нажатие */
.liab-what-list label:active {
    transform: translateY(1px);
}

/* базовый (выключено) */
.liab-what-list label span {
    color: #9ca3af;          /* серый текст */
}
/* включено */
.liab-what-list input[type="checkbox"]:checked + span {
    color: #111827;          /* почти чёрный */
    font-weight: 500;
}



.liab-what-list label {
    background: #f9fafb;
}

.liab-what-list input[type="checkbox"]:checked + span {
    text-decoration: none;
}

.liab-what-list input[type="checkbox"]:not(:checked) + span {
    text-decoration: line-through;
    opacity: 0.7;
}


/* =========================================
   ДЕТАЛИЗАЦИЯ ТОЛЬКО В СВЕРКЕ
========================================= */

.liab-table .poster {
    cursor: default;
}

.liab-table .poster .descr {
    display: block;          /* управляем только opacity */
    opacity: 0;
    pointer-events: none;

    padding: 10px;
    background: #f3f3f3;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.3);

    text-align: left;
    max-width: calc(100vw - 80px) !important;

    position: fixed;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 105;

    transition: opacity 0.15s ease;
}

/* hover ТОЛЬКО внутри сверки */
.liab-table .poster:hover .descr {
    opacity: 1;
    pointer-events: auto;
}

/* твой кейс с серыми строками */
.liab-table tr.grey .descr {
    color: #000 !important;
}
.liab-summary {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    font-size: 14px;
}

.liab-summary div {
    margin: 4px 0;
}

.liab-final {
    margin-top: 6px;
    font-weight: 600;
}
.poster {
    position: relative;
    cursor: pointer;
}

.act-icon {
    margin-left: 6px;
    font-size: 13px;
    opacity: 0.8;
}

.act-preview {
    margin-top: 8px;
    border: 1px solid #ddd;
    height: 400px;
}

.act-preview iframe {
    width: 100%;
    height: 100%;
    border: 0;
}
.liab-table tfoot tr {
    background: #f7f7f7;
    border-top: 2px solid #999;
}

.liab-table tfoot td {
    padding-top: 8px;
    padding-bottom: 8px;
}

.liab-table tfoot small {
    color: #555;
    line-height: 1.3;
}
.print-act-header, .print-act-sign {
    display: none;
}
