.legacy-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    color: #1e293b;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.legacy-spinner[hidden] {
    display: none;
}

/* Invoices */

/* ---------------------------------------
   Portal User Header
--------------------------------------- */

.portal-user-card-company {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #16161F;
}

.portal-user-card-user {
    font-size: 1rem;
    color: #5A5A5A;
}


/* =======================================
   INVOICES TABLE (Elementor Isolated)
======================================= */

.elementor .legacy-invoices-table {
    /* Reset inherited Elementor table styling */
    all: unset;
    display: table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;

    /* Our styling */
    font-size: 0.9rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
}

/* ---------------------------------------
   Table Structure
--------------------------------------- */

.elementor .legacy-invoices-table th {
    border: 0;
    border-top: none !important;
    background: #f4f4f4 !important;
    padding: 0 1.5rem;
    vertical-align: middle;
}

.elementor .legacy-invoices-table td {
    border: 0;
    background: #ffffff !important;
    padding: 0 1.5rem;
    vertical-align: middle;
}

.elementor .legacy-invoices-table thead {
    background: #f3f4f6;
}

.elementor .legacy-invoices-table thead th {
    height: 54px;
    font-weight: 500;
    color: #16161F;
    white-space: nowrap;
    border-bottom: 1px solid #e5e7eb;
}

.elementor .legacy-invoices-table tbody tr {
    height: 54px;
}

/* Row separators */
.elementor .legacy-invoices-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #e5e7eb;
}

/* Remove zebra + hover */
.elementor .legacy-invoices-table tbody tr:nth-child(even),
.elementor .legacy-invoices-table tbody tr:nth-child(odd),
.elementor .legacy-invoices-table tbody tr:hover {
    background: #ffffff !important;
}

/* ---------------------------------------
   Column Behavior
--------------------------------------- */

.col-tracking {
    width: 100%;
}

th.col-tracking {
    text-align: left;
}

.col-carrier {
    width: 80px;
    text-align: center;
    white-space: nowrap;
}

.col-details {
    width: 80px;
    text-align: center;
    white-space: nowrap;
}

/* ---------------------------------------
   Tracking Link
--------------------------------------- */
/* 
.tracking-link {
    color: #2563eb;
    text-decoration: none;
    word-break: break-all;
}

.tracking-link:hover {
    text-decoration: underline;
} */

.legacy-invoices-table td.col-tracking a.tracking-link,
.legacy-invoices-table td.col-tracking a.tracking-link:visited {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    padding: 6px 12px !important;
    border: 1px solid #D1D5DB !important;
    border-radius: 999px !important;

    background: #FFFFFF !important;
    color: #1F2937 !important;

    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;

    cursor: pointer;
}

.legacy-invoices-table td.col-tracking a.tracking-link:hover,
.legacy-invoices-table td.col-tracking a.tracking-link:focus {
    background: #F3F4F6 !important;
    border-color: #C7CDD4 !important;
    color: #1F2937 !important;
    text-decoration: none !important;
}

/* ---------------------------------------
   Carrier
--------------------------------------- */

.carrier-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 54px;
}

/* Override Elementor image defaults */
.elementor .legacy-invoices-table td.col-carrier img.carrier-logo {
    width: auto;
    height: 26px;
    max-width: none;
    display: block;
}

/* ---------------------------------------
   Details Button
--------------------------------------- */

.legacy-invoices-table .legacy-receipt-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    border-radius: 50% !important;
    border: none !important;
    background: transparent !important;
    color: #232323 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    line-height: 0 !important;
    box-shadow: none !important;
    appearance: none;
    cursor: pointer;
}

.legacy-invoices-table .legacy-receipt-btn:hover,
.legacy-invoices-table .legacy-receipt-btn:active,
.legacy-invoices-table .legacy-receipt-btn:focus {
    color: #16161F !important;
    background: #DEDEDE !important;
    border: none !important;
    box-shadow: none !important;
    outline: none;
}

.legacy-invoices-table .legacy-receipt-btn svg {
    width: 22px !important;
    height: 22px !important;
    display: block;
    flex-shrink: 0;
}

.legacy-details-icon {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}


/* Failed to load */

.legacy-invoices-error:not([hidden]) {
    display: flex;
    justify-content: center;
    padding: 60px 20px;
}

.legacy-error-card {
    width: 100%;
    max-width: 720px;

    padding: 48px;

    text-align: center;

    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
}

.legacy-error-icon {
    width: 72px;
    height: 72px;

    margin: 0 auto 24px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 32px;

    background: #FEF2F2;
    color: #DC2626;

    border-radius: 999px;
}

.legacy-error-title {
    margin: 0 0 12px;

    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;

    color: #111827;
}

.legacy-error-message {
    margin: 0 0 32px;

    font-size: 16px;
    line-height: 1.6;

    color: #6B7280;
}

.legacy-refresh-btn {
    min-width: 220px;
    height: 48px;

    padding: 0 24px;

    border: 0;
    border-radius: 8px;

    background: #1F3F69;
    color: #ffffff;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;

    transition: background-color .2s ease;
}

.legacy-refresh-btn:hover {
    background: #183354;
}

.legacy-invoices-loading:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.legacy-loading-message {
    margin-top: 16px;
    color: #6B7280;
    font-size: 14px;
}


/* Panel */

.panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: #1e293b; /* brand color */
}

#invoice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    z-index: 9998;
}

#invoice-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

#invoice-panel {
    position: fixed;
    top: 0;
    right: -720px;
    width: 720px;
    height: 100vh;
    background: #fff;
    transition: right .3s ease;
    z-index: 9999;
    overflow-y: auto;
    padding: 2rem;
}

#invoice-panel.is-open {
    right: 0;
}


/* =======================================
   PANEL LAYOUT
======================================= */


/* Header */
.invoice-panel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 2rem;
}

#invoice-panel .panel-back-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;

    border-radius: 50% !important;
    border: none !important;

    background: #f3f4f6 !important;
    color: #16161F !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 0 !important;
    margin: 0 !important;

    box-shadow: none !important;
    appearance: none !important;

    cursor: pointer !important;
    transition: background 0.2s ease;
}

#invoice-panel .panel-back-btn:hover,
#invoice-panel .panel-back-btn:focus,
#invoice-panel .panel-back-btn:active {
    background: #e5e7eb !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

#invoice-close svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

#invoice-panel-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #16161F;
    margin: 0;
}

/* =======================================
   SUMMARY BLOCK (Top Card)
======================================= */

.invoice-summary-card {
    background: #eef2f7; /* soft tinted background */
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.invoice-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem 2.5rem;
}

.invoice-summary-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
}

.invoice-summary-value {
    font-size: 1rem;
    color: #16161F;
}

/* =======================================
   LINE ITEM CARDS
======================================= */

.invoice-item-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    background: #ffffff;
}

.invoice-item-title {
    font-weight: 600;
    font-size: 1rem;
    color: #16161F;
}

.invoice-item-meta {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.invoice-item-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
}

.invoice-item-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
}

.invoice-item-value {
    font-size: 1rem;
    color: #16161F;
}



#legacy-invoices-loading[hidden],
#legacy-invoices-error[hidden] {
    display: none !important;
}

/* Proof of Delivery */

button.legacy-pod-pill,
button.legacy-pod-pill:focus,
button.legacy-pod-pill:active {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;

  width: fit-content !important;
  min-height: 0 !important;
  margin: 0 0 16px !important;
  padding: 6px 12px !important;

  border: 1px solid #16161F !important;
  border-radius: 999px !important;

  background: #fff !important;
  background-color: #fff !important;
  color: #16161F !important;

  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.1 !important;

  box-shadow: none !important;
  text-decoration: none !important;
  cursor: pointer !important;
  appearance: none !important;
}

button.legacy-pod-pill:hover {
    background-color: #f4f4f4 !important;
}

button.legacy-pod-pill:disabled {
  opacity: .6 !important;
  cursor: wait !important;
}

button.legacy-pod-pill .legacy-pod-icon {
  width: 14px !important;
  height: 14px !important;
  display: block !important;
  flex-shrink: 0 !important;
}