﻿@import url("base/base.css");
@import url("base/navigation.css");
@import url("pages/plan.css");
@import url("pages/calculateur.css");
@import url("pages/facturation.css");
@import url("pages/statistiques.css");
@import url("pages/auth.css");
@import url("base/responsive.css");

[hidden] {
    display: none !important;
}

.billing-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.billing-actions .billing-save-btn,
.billing-actions .billing-export-btn,
.billing-actions .billing-print-btn {
    position: static;
    right: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.billing-action-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.billing-layout {
    grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
}

.billing-editor,
.billing-panel,
.invoice-preview-wrap {
    min-width: 0;
}

.billing-save-btn {
    border: 0;
    border-radius: 6px;
    padding: 10px 14px;
    color: #ffffff;
    background: #0f766e;
    font-weight: 700;
    cursor: pointer;
}

.billing-save-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.billing-print-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    filter: grayscale(0.45);
}

.billing-save-status {
    display: block;
    min-height: 18px;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.billing-save-status[data-status="success"] {
    color: #047857;
}

.billing-save-status[data-status="error"] {
    color: #b91c1c;
}

.billing-save-status[data-status="warning"] {
    color: #b45309;
}

.billing-save-status[data-status="pending"] {
    color: #0369a1;
}

.saved-invoices-list {
    display: grid;
    gap: 8px;
    max-height: 280px;
    overflow: auto;
    padding-right: 2px;
}

.saved-invoice-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 6px;
    align-items: stretch;
}

.saved-invoice-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 6px;
    padding: 10px;
    color: #0f172a;
    background: #ffffff;
    text-align: left;
    cursor: pointer;
}

.saved-invoice-item:hover,
.saved-invoice-row.is-selected .saved-invoice-item {
    border-color: #0f766e;
    background: #ecfdf5;
}

.saved-invoice-reuse {
    width: 36px;
    border: 1px solid rgba(15, 118, 110, 0.28);
    border-radius: 6px;
    background: #f0fdfa;
    color: #0f766e;
    font-size: 20px;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
}

.saved-invoice-reuse:hover {
    border-color: #0f766e;
    background: #ccfbf1;
}

.saved-invoice-item span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.saved-invoice-item strong,
.saved-invoice-item small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-invoice-item small {
    color: #64748b;
    font-size: 12px;
}

.saved-invoices-empty {
    border: 1px dashed rgba(100, 116, 139, 0.35);
    border-radius: 6px;
    padding: 12px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

.saved-invoice-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.invoice-delete-btn {
    border: 1px solid rgba(185, 28, 28, 0.28);
    border-radius: 8px;
    margin-top: 8px;
    padding: 9px 12px;
    color: #991b1b;
    background: #fff1f2;
    font-weight: bold;
    cursor: pointer;
}

.invoice-delete-btn:hover {
    border-color: #b91c1c;
    background: #ffe4e6;
}

.invoice-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.legacy-deposit-field label:first-child {
    display: none;
}

.legacy-deposit-field {
    grid-template-columns: 1fr;
}

.billing-payment-rows {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.billing-payment-row {
    display: grid;
    grid-template-columns: minmax(138px, 1.35fr) 82px 96px 34px;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.42);
}

.billing-payment-row label {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: #38bdf8;
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.billing-payment-row input,
.billing-payment-row select {
    width: 100%;
    min-width: 0;
    padding: 10px 11px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    color: #f8fafc;
    font: inherit;
}

.billing-payment-row .payment-remove {
    width: 34px;
    min-width: 34px;
    height: 39px;
    align-self: end;
    display: inline-grid;
    place-items: center;
    padding: 0;
    font-size: 20px;
    line-height: 1;
}

.billing-fields input[readonly] {
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.72);
    cursor: default;
}

@media (max-width: 720px) {
    .billing-layout {
        grid-template-columns: 1fr;
    }

    .invoice-preview-wrap {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .invoice-sheet {
        width: 820px;
        max-width: none;
        min-width: 820px;
        box-sizing: border-box;
        transform-origin: top left;
    }

    .billing-payment-row {
        grid-template-columns: minmax(0, 1fr) 34px;
    }

    .billing-payment-row label {
        grid-column: 1 / -1;
    }

    .billing-payment-row .payment-remove {
        grid-column: 2;
        justify-self: end;
    }
}
