/* CONNECTOR_PROJECT_CASHFLOW_CSS_V1 */

.cashflow-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.cashflow-header h1 {
    margin: 0 0 6px;
    color: #0f172a;
}

.cashflow-header p {
    margin: 0;
    color: #64748b;
}

.cashflow-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.cashflow-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 43px;
    margin: 0;
    padding: 10px 14px;

    border: 0;
    border-radius: 11px;

    background: #2563eb;
    color: #ffffff;

    font-weight: 900;
    cursor: pointer;
}

.cashflow-button.secondary {
    background: #e2e8f0;
    color: #334155;
}

.cashflow-button.dark {
    background: #0f172a;
    color: #ffffff;
}

.cashflow-button.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.cashflow-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cashflow-toolbar {
    display: grid;

    grid-template-columns:
        minmax(250px, 1.7fr)
        minmax(150px, 0.8fr)
        minmax(150px, 0.8fr)
        auto;

    gap: 10px;
    align-items: end;

    margin-bottom: 16px;
    padding: 15px;

    border: 1px solid #dbe3ef;
    border-radius: 17px;

    background:
        linear-gradient(
            135deg,
            #ffffff,
            #f8fafc
        );

    box-shadow:
        0 8px 22px
        rgba(15, 23, 42, 0.06);
}

.cashflow-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.cashflow-field span {
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cashflow-field input,
.cashflow-field select,
.cashflow-field textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;

    padding: 10px 11px;

    border: 1px solid #cbd5e1;
    border-radius: 11px;

    background: #ffffff;
}

.cashflow-field textarea {
    min-height: 86px;
    resize: vertical;
}

.cashflow-project-context {
    display: none;
    align-items: center;
    gap: 10px;

    margin-bottom: 14px;
    padding: 11px 14px;

    border: 1px solid #bfdbfe;
    border-radius: 13px;

    background: #eff6ff;
    color: #1e3a8a;
}

.cashflow-project-context.visible {
    display: flex;
}

.cashflow-project-context i {
    display: grid;
    place-items: center;

    width: 35px;
    height: 35px;
    flex: 0 0 35px;

    border-radius: 10px;

    background: #dbeafe;
    color: #1d4ed8;
}

.cashflow-project-context strong,
.cashflow-project-context small {
    display: block;
}

.cashflow-project-context small {
    margin-top: 2px;
    color: #64748b;
}

.cashflow-summary {
    display: grid;

    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap: 11px;
    margin-bottom: 16px;
}

.cashflow-summary article {
    min-width: 0;
    padding: 14px;

    border: 1px solid #e2e8f0;
    border-radius: 16px;

    background: #ffffff;

    box-shadow:
        0 7px 20px
        rgba(15, 23, 42, 0.06);
}

.cashflow-summary article.inflow {
    border-top: 4px solid #16a34a;
}

.cashflow-summary article.outflow {
    border-top: 4px solid #f97316;
}

.cashflow-summary article.balance {
    border-top: 4px solid #2563eb;
}

.cashflow-summary article.minimum {
    border-top: 4px solid #8b5cf6;
}

.cashflow-summary article.deficit {
    border-top: 4px solid #ef4444;
}

.cashflow-summary span,
.cashflow-summary strong,
.cashflow-summary small {
    display: block;
}

.cashflow-summary span {
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cashflow-summary strong {
    margin-top: 6px;
    color: #0f172a;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.cashflow-summary small {
    margin-top: 5px;
    color: #64748b;
    font-size: 10px;
    line-height: 1.35;
}

.cashflow-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1.65fr)
        minmax(320px, 0.75fr);

    gap: 14px;
    margin-bottom: 15px;
}

.cashflow-panel {
    min-width: 0;
    padding: 15px;

    border: 1px solid #e2e8f0;
    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 8px 24px
        rgba(15, 23, 42, 0.06);
}

.cashflow-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.cashflow-panel-header h2,
.cashflow-panel-header h3 {
    margin: 0;
    color: #0f172a;
}

.cashflow-panel-header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 11px;
}

.cashflow-chart-wrap {
    position: relative;
    min-height: 310px;
}

#cashflow-chart {
    display: block;
    width: 100%;
    height: 310px;
}

.cashflow-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;

    margin-top: 10px;

    color: #475569;
    font-size: 11px;
    font-weight: 800;
}

.cashflow-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cashflow-legend i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.cashflow-legend .planned-inflows i {
    background: #86efac;
}

.cashflow-legend .actual-inflows i {
    background: #16a34a;
}

.cashflow-legend .planned-outflows i {
    background: #fdba74;
}

.cashflow-legend .actual-outflows i {
    background: #ea580c;
}

.cashflow-legend .balance-line i {
    background: #2563eb;
}

.cashflow-side-list {
    display: grid;
    gap: 9px;
}

.cashflow-side-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;

    padding: 11px;

    border: 1px solid #e2e8f0;
    border-radius: 12px;

    background: #f8fafc;
}

.cashflow-side-item strong,
.cashflow-side-item span,
.cashflow-side-item small {
    display: block;
}

.cashflow-side-item strong {
    color: #0f172a;
    overflow-wrap: anywhere;
}

.cashflow-side-item span,
.cashflow-side-item small {
    margin-top: 3px;
    color: #64748b;
    font-size: 10px;
}

.cashflow-side-item b {
    color: #0f172a;
    white-space: nowrap;
}

.cashflow-side-actions {
    display: flex;
    gap: 5px;
}

.cashflow-side-actions button {
    display: grid;
    place-items: center;

    width: 34px;
    height: 34px;

    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 9px;

    background: #dbeafe;
    color: #1d4ed8;

    cursor: pointer;
}

.cashflow-side-actions button.delete {
    background: #fee2e2;
    color: #b91c1c;
}

.cashflow-table-wrap {
    overflow: auto;

    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.cashflow-table {
    width: 100%;
    min-width: 1280px;

    margin: 0;

    border-radius: 0;
    box-shadow: none;
}

.cashflow-table th,
.cashflow-table td {
    padding: 10px 9px;
    vertical-align: top;
}

.cashflow-table tbody tr {
    cursor: pointer;
}

.cashflow-table tbody tr:hover td {
    background: #eff6ff;
}

.cashflow-table strong,
.cashflow-table small,
.cashflow-table span {
    display: block;
}

.cashflow-table small {
    margin-top: 3px;
    color: #64748b;
}

.cashflow-money {
    color: #0f172a;
    font-weight: 900;
    white-space: nowrap;
}

.cashflow-money.positive {
    color: #166534;
}

.cashflow-money.negative {
    color: #b91c1c;
}

.cashflow-money.warning {
    color: #b45309;
}

.cashflow-balance-badge {
    display: inline-flex;
    align-items: center;

    width: max-content;

    padding: 6px 9px;

    border-radius: 999px;

    background: #dbeafe;
    color: #1d4ed8;

    font-size: 10px;
    font-weight: 900;
}

.cashflow-balance-badge.negative {
    background: #fee2e2;
    color: #b91c1c;
}

.cashflow-month-mobile {
    display: none;
}

.cashflow-mobile-card {
    padding: 14px;

    border: 1px solid #e2e8f0;
    border-left: 5px solid #2563eb;
    border-radius: 16px;

    background: #ffffff;

    box-shadow:
        0 7px 18px
        rgba(15, 23, 42, 0.06);
}

.cashflow-mobile-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.cashflow-mobile-head h3 {
    margin: 0;
    color: #0f172a;
}

.cashflow-mobile-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 8px;
    margin-top: 11px;
}

.cashflow-mobile-grid div {
    padding: 9px;
    border-radius: 10px;
    background: #f8fafc;
}

.cashflow-mobile-grid span,
.cashflow-mobile-grid strong {
    display: block;
}

.cashflow-mobile-grid span {
    color: #64748b;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.cashflow-mobile-grid strong {
    margin-top: 3px;
    color: #0f172a;
    font-size: 12px;
}

.cashflow-empty,
.cashflow-loading,
.cashflow-error {
    padding: 26px;
    text-align: center;
}

.cashflow-empty,
.cashflow-loading {
    color: #64748b;
}

.cashflow-error {
    color: #b91c1c;
}

.cashflow-modal-box {
    display: flex;
    flex-direction: column;

    width: min(1120px, 96vw);
    height: min(92vh, 920px);
    max-height: 92vh;

    padding: 0;
    gap: 0;

    overflow: hidden;
}

.cashflow-modal-box.small {
    width: min(720px, 95vw);
}

.cashflow-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;

    flex: 0 0 auto;

    padding: 17px 19px;

    background:
        linear-gradient(
            135deg,
            #0f172a,
            #1d4ed8
        );

    color: #ffffff;
}

.cashflow-modal-header h2 {
    margin: 4px 0 0;
    color: #ffffff;
}

.cashflow-modal-header p {
    margin: 4px 0 0;
    color: #bfdbfe;
    font-size: 11px;
}

.cashflow-modal-close {
    display: grid;
    place-items: center;

    width: 40px;
    height: 40px;

    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 11px;

    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;

    cursor: pointer;
}

.cashflow-modal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px;
    overflow: auto;
    background: #f8fafc;
}

.cashflow-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;

    flex: 0 0 auto;

    padding: 13px 16px;

    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.cashflow-form-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 11px;
}

.cashflow-form-grid .full {
    grid-column: 1 / -1;
}

.cashflow-switch-option {
    position: relative;

    display: flex;
    align-items: center;
    gap: 10px;

    grid-column: 1 / -1;

    min-height: 48px;
    padding: 9px 12px;

    border: 1px solid #dbe4f0;
    border-radius: 13px;

    background: #ffffff;

    cursor: pointer;
}

.cashflow-switch-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.cashflow-switch {
    position: relative;

    width: 40px;
    height: 23px;
    flex: 0 0 40px;

    border-radius: 999px;

    background: #cbd5e1;

    transition: background 0.18s ease;
}

.cashflow-switch::after {
    content: "";

    position: absolute;
    top: 3px;
    left: 3px;

    width: 17px;
    height: 17px;

    border-radius: 50%;

    background: #ffffff;

    box-shadow:
        0 2px 6px
        rgba(15, 23, 42, 0.25);

    transition: transform 0.18s ease;
}

.cashflow-switch-option
input:checked
+
.cashflow-switch {
    background: #2563eb;
}

.cashflow-switch-option
input:checked
+
.cashflow-switch::after {
    transform: translateX(17px);
}

.cashflow-switch-copy strong,
.cashflow-switch-copy small {
    display: block;
}

.cashflow-switch-copy strong {
    color: #0f172a;
    font-size: 12px;
}

.cashflow-switch-copy small {
    margin-top: 2px;
    color: #64748b;
    font-size: 10px;
}

.cashflow-lines-list {
    display: grid;
    gap: 8px;
}

.cashflow-line-item {
    display: grid;
    grid-template-columns:
        100px
        minmax(0, 1fr)
        auto;

    gap: 11px;
    align-items: center;

    padding: 11px;

    border: 1px solid #e2e8f0;
    border-radius: 12px;

    background: #ffffff;
}

.cashflow-line-date {
    color: #475569;
    font-size: 11px;
    font-weight: 900;
}

.cashflow-line-main strong,
.cashflow-line-main span,
.cashflow-line-main small {
    display: block;
}

.cashflow-line-main strong {
    color: #0f172a;
}

.cashflow-line-main span,
.cashflow-line-main small {
    margin-top: 3px;
    color: #64748b;
    font-size: 10px;
}

.cashflow-line-amount {
    color: #0f172a;
    font-weight: 900;
    white-space: nowrap;
}

.cashflow-line-amount.inflow {
    color: #166534;
}

.cashflow-line-amount.outflow {
    color: #b91c1c;
}

.cashflow-closed-warning {
    display: none;

    margin-bottom: 13px;
    padding: 11px 13px;

    border: 1px solid #fecaca;
    border-radius: 12px;

    background: #fff7f7;
    color: #b91c1c;

    font-size: 12px;
    font-weight: 900;
}

.cashflow-closed-warning.visible {
    display: block;
}

@media (max-width: 1300px) {

    .cashflow-summary {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .cashflow-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {

    .cashflow-toolbar {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .cashflow-toolbar
    .cashflow-field:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {

    .cashflow-header {
        flex-direction: column;
        align-items: stretch;
    }

    .cashflow-header-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .cashflow-header-actions button {
        width: 100%;
    }

    .cashflow-toolbar {
        grid-template-columns: 1fr;
    }

    .cashflow-toolbar
    .cashflow-field:first-child {
        grid-column: auto;
    }

    .cashflow-summary {
        grid-template-columns: 1fr;
    }

    .cashflow-summary article {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    .cashflow-summary strong {
        margin: 0;
        text-align: right;
    }

    .cashflow-summary small {
        display: none;
    }

    .cashflow-table-wrap {
        display: none;
    }

    .cashflow-month-mobile {
        display: grid;
        gap: 10px;
    }

    .cashflow-form-grid {
        grid-template-columns: 1fr;
    }

    .cashflow-form-grid .full,
    .cashflow-switch-option {
        grid-column: auto;
    }

    .cashflow-modal-box,
    .cashflow-modal-box.small {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;

        margin: 0;
        border-radius: 0;
    }

    .cashflow-line-item {
        grid-template-columns: 1fr;
    }

    .cashflow-line-amount {
        white-space: normal;
    }

    .cashflow-modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;

        padding-bottom:
            calc(
                12px
                +
                env(safe-area-inset-bottom)
            );
    }
}

/* CONNECTOR_STAGE_09_3_3_CASHFLOW_OPENING_BALANCE_CSS_V1 */

.cashflow-summary article.opening {
    border-top: 4px solid #0891b2;
}

.cashflow-summary article.opening strong {
    color: #0e7490;
}

.cashflow-summary article.opening small {
    color: #64748b;
}

