.einv-popup-body {
    font-family: system-ui, sans-serif;
    width: 600px;
    max-width: 600px;
    max-height: 300px;
    /* NIC can return a dozen error codes at once; without this the list is silently clipped by
       max-height and the user only sees the first line or two. */
    overflow-y: auto;
    padding: 4px 2px;
    /* 6px, not 20px: the shared .custom-modal-footer already contributes its own padding-top plus a
       border above the buttons, so a large margin here just doubles the divider's breathing room.
       Matches .gst-popup-body, which already used a tighter value. */
    margin-bottom: 6px;
}

.einv-loading {
    text-align: center;
    padding: 24px 0;
    opacity: 0.7;
}

.einv-saved-view {
    display: grid;
    grid-template-columns: 1fr 0.5fr;
    align-items: center;
    gap: 6px;
}


/* Force the first column to stack text vertically */
.einv-saved-view-column:first-child {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Center the canvas inside the second column */
.einv-saved-view-column {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; /* Ensures full width utilization */
}

.einv-qr-note {
    grid-column: span 2; /* Spans across both columns */
    font-size: 0.72rem;
    opacity: 0.6;
    text-align: center;
    margin: 8px 0 0;
}

.einv-field {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: .9rem;
    padding: 2px 0;
}

.einv-field span {
    opacity: .65;
    white-space: nowrap;
}

.einv-irn {
    word-break: break-all;
    text-align: right;
    font-size: 0.9rem;
}

.einv-qr-canvas {
    height: 100px;
    width: 100px;
    background: #fff;
}

.einv-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #8883;
}

.einv-summary span {
    display: block;
    font-size: .72rem;
    opacity: .6;
}

.einv-summary strong {
    font-size: .88rem;
}

.einv-error {
    margin-top: 12px;
    padding: 8px 10px;
    background: #c6282814;
    border-left: 3px solid #c62828;
    border-radius: 4px;
    font-size: .82rem;
}

.einv-error ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.einv-rule-note {
    font-size: .78rem;
    opacity: .75;
    margin: 10px 0 0;
}

/* Square icon button sized to match .btn-secondary's 30px height. Deliberately not a .btn — that
   would inherit .custom-modal-footer .btn's flex-basis: 300px and stretch across the footer. */
.einv-icon-btn {
    flex: 0 0 auto;
    width: 50px;
    height: 30px;
    padding: 0;
    background: #6c757d;
    border: none;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
    border-radius: 4px;
}

.einv-icon-btn:hover {
    background: #5c636a;
}

.einv-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.einv-icon-btn svg {
    width: 30px;
    height: 30px;
}

/* --- Cancellation ------------------------------------------------------------------------------
   The IRP allows this within 24 hours of acknowledgement, in full only, and refuses while an active
   e-way bill exists against the IRN. See EinvoiceDetailPopup.ConfirmCancel. */

/* Cancelled is a state, not an error: the IRN below stays on screen because the IRP's record of it
   survives and GSTR-1 still has to account for it. */
.einv-cancelled-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-left: 3px solid #dc3545;
    background: #fdf2f3;
    border-radius: 4px;
    font-size: 0.82rem;
    color: #58151c;
}

.einv-cancelled-banner strong {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #dc3545;
}

.einv-action-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
}

.einv-action-header h4 {
    margin: 0 0 4px;
    font-size: 0.92rem;
}

.einv-action-rule {
    display: block;
    margin-bottom: 10px;
    font-size: 0.76rem;
    line-height: 1.45;
    color: #6c757d;
}

.einv-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.einv-action-grid label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.78rem;
    color: #495057;
}

.einv-action-grid input,
.einv-action-grid select {
    height: 30px;
    padding: 0 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.82rem;
    background: #ffffff;
}

.einv-action-wide {
    grid-column: 1 / -1;
}

.einv-action-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.einv-action-btn {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 12px;
    background: #6c757d;
    border: none;
    color: #ffffff;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
    border-radius: 4px;
}

.einv-action-btn:hover {
    background: #5c636a;
}

.einv-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.einv-action-btn-danger {
    background: #dc3545;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.einv-action-btn-danger:hover {
    background: #bb2d3b;
}

/* The 30-day IRP reporting deadline, which binds only above a turnover SimpleBilling doesn't record
   — so it advises rather than blocks. */
.einv-warning {
    margin-top: 10px;
    padding: 8px 12px;
    border-left: 3px solid #ffc107;
    background: #fff9e6;
    border-radius: 4px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #664d03;
}

.einv-warning ul {
    margin: 0;
    padding-left: 18px;
}

/* --- Duplicate-IRN recovery --------------------------------------------------------------------
   The escape route from IRP error 2150: fetch what the IRP already registered under this document
   number and compare it, field by field, before adopting its IRN.
   See RecoverExistingIrn / EInvoiceReconciler. */

.einv-recover-btn {
    margin-top: 10px;
}

.einv-reconcile {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    border-left: 3px solid;
    font-size: 0.79rem;
    line-height: 1.5;
}

.einv-reconcile.is-ok {
    border-left-color: #198754;
    background: #f0f9f4;
    color: #0f5132;
}

.einv-reconcile.is-error {
    border-left-color: #dc3545;
    background: #fdf2f3;
    color: #58151c;
}

.einv-reconcile-head strong {
    display: block;
    margin-bottom: 2px;
}

/* The table is the point of the whole feature — the user has to be able to see WHAT was compared
   before trusting a filing, so it is never collapsed or summarised away. */
.einv-reconcile-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.einv-reconcile-table th,
.einv-reconcile-table td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.einv-reconcile-table th {
    font-weight: bold;
    opacity: .75;
}

/* Values can be long (GSTINs, document numbers) — let them wrap rather than widen the popup. */
.einv-reconcile-table td {
    word-break: break-word;
}

.einv-reconcile-table tr.is-diff td {
    font-weight: bold;
    background: rgba(220, 53, 69, .07);
}
