/* ==========================================================================
   Finance UI (invoices, quotations, payments) — stat cards + overflow guards.
   ========================================================================== */

.fin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.fin-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 14px;
    padding: 14px 16px;
    min-width: 0;
    border: none;
    text-decoration: none;
}

.fin-stat__meta {
    min-width: 0;
}

.fin-stat__label {
    font-size: 0.76rem;
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fin-stat__value {
    font-size: clamp(1rem, 2.4vw, 1.35rem);
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: break-word;
    word-break: break-word;
}

.fin-stat__icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.45);
}

@media (max-width: 575.98px) {
    .fin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .fin-stat {
        padding: 11px 12px;
    }

    .fin-stat__icon {
        display: none;
    }
}

/* Colour variants (pastel gradients, dark accessible text) */
.fin-stat--indigo { background: linear-gradient(135deg, #b8c0ff 0%, #d4daff 100%); color: #303f9f; }
.fin-stat--green  { background: linear-gradient(135deg, #c8e6c9 0%, #e0f2e1 100%); color: #2e7d32; }
.fin-stat--amber  { background: linear-gradient(135deg, #ffecb3 0%, #fff6da 100%); color: #b26a00; }
.fin-stat--rose   { background: linear-gradient(135deg, #ffcdd2 0%, #ffe5e9 100%); color: #c62828; }
.fin-stat--blue   { background: linear-gradient(135deg, #bbdefb 0%, #e0f0fd 100%); color: #1565c0; }
.fin-stat--slate  { background: linear-gradient(135deg, #e2e6ec 0%, #f1f3f7 100%); color: #4a5568; }
.fin-stat--indigo .fin-stat__icon { color: #303f9f; }
.fin-stat--green .fin-stat__icon { color: #2e7d32; }
.fin-stat--amber .fin-stat__icon { color: #b26a00; }
.fin-stat--rose .fin-stat__icon { color: #c62828; }
.fin-stat--blue .fin-stat__icon { color: #1565c0; }
.fin-stat--slate .fin-stat__icon { color: #4a5568; }

/* --- Overflow guards for finance tables & modals ------------------------- */

/* Long descriptions, GSTINs and amounts must wrap inside cells */
.fin-guard td,
.fin-guard th {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Line-item tables inside modals: stop fixed widths from crushing inputs */
.modal .table-responsive table {
    table-layout: auto;
    min-width: 420px;
}

.modal .table-responsive input.form-control,
.modal .table-responsive select.form-select {
    min-width: 90px;
}
