/* Approvals Table Styles */
/* Ensure invoice-box and scroll-x-table are flex containers for side-by-side mode */
.invoice-box {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.scroll-x-table {
    flex: 1 1 auto;
}
/* Editable column for fields with edit icon/button */
.col-editable {
    min-width: 160px;
    max-width: 240px;
}
:root {
    --rdn-dark: #023E2C;
    --rdn-accent: #C8DD69;
    --rdn-light: #fff;
}

body {
    background: var(--rdn-light);
    color: var(--rdn-dark);
    font-family: 'Segoe UI', Arial, sans-serif;
}

.page {
    background: var(--rdn-light);
    min-height: 100vh;
    display: flex;
}

/* Sidebar styles now managed by MainLayout.razor.css (scoped CSS Grid) */

.navbar, .navbar-brand {
    background: var(--rdn-dark) !important;
    color: var(--rdn-light) !important;
}

.nav-link {
    color: var(--rdn-light) !important;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.nav-link.active {
    color: var(--rdn-dark) !important;
}

.top-row {
    background: var(--rdn-dark);
    color: var(--rdn-light);
    padding: 1em 2em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--rdn-accent);
}

.top-row a {
    color: var(--rdn-accent);
    font-weight: 600;
    text-decoration: none;
}

.content {
    background: var(--rdn-light);
    border-radius: 8px;
    margin: 0;
    /* box-shadow removed */
    padding: 2em;
}

.approvals-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    box-shadow: none;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 2em;
    border: 1px solid #dee2e6;
}

.approvals-table th {
    background: #f8f9fa;
    color: #1a1a1a;
    font-weight: 500;
    padding: 0.75em 0.75em;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 1.05em;
    white-space: nowrap;
}
.invoice-lines-table {
    width: 100%;
    min-width: 1600px;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    box-shadow: none;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 2em;
    border: 1px solid #dee2e6;
}
.invoice-lines-table th {
    background: #f8f9fa;
    color: #1a1a1a;
    font-weight: 500;
    padding: 0.75em 0.5em;
    min-width: 140px;
    max-width: 220px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 1.05em;
    white-space: nowrap;
}

.approvals-table td {
    padding: 0.75em 0.75em;
    border-bottom: 1px solid #e6e6e6;
    font-size: 1em;
    color: var(--rdn-dark);
    text-align: left;
    white-space: nowrap;
}

/* Changed from green to grey for even rows */
.approvals-table tr.prod-row:nth-child(even) {
    background: #f3f3f3;
}

.approvals-table tr.prod-row:hover {
    background: #f5f8fc !important;
    color: var(--rdn-light);
    transition: background 0.15s;
}

.approvals-table td:last-child,
.approvals-table th:last-child {
    text-align: right;
}

.approvals-table td {
    vertical-align: middle;
}

.approvals-table .currency {
    font-weight: bold;
    color: var(--rdn-accent);
}

/* Currency label — plain inline text, no pill (matches Figma Label/CAPS style) */
.currency-pill {
    display: inline-block;
    font-family: var(--font-body, 'IBM Plex Sans', sans-serif);
    font-weight: 400;
    font-size: 10px;
    line-height: 16px;
    color: rgba(0, 0, 0, 0.5);
    letter-spacing: 0.2px;
    text-transform: uppercase;
    margin-left: 4px;
    vertical-align: baseline;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
}

.attachment-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border: none;
    border-radius: 50%;
    background: #f3f6fa;
    color: var(--rdn-dark, #1976d2);
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: none;
    cursor: pointer;
    padding: 0;
    outline: none;
}

.attachment-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
}

.attachment-icon:hover, .attachment-icon:focus {
    background: #e3eafc;
    color: #0d47a1;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
}

.attachment-icon:active {
    background: #d2e3fc;
}

.vendor-info-group {
    margin-bottom: 0.5em;
    font-size: 1em;
    line-height: 1.3;
}
.vendor-no {
    font-size: 0.95em;
    color: #595959;
    font-weight: 500;
    margin-bottom: 0.1em;
}
.vendor-name {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--rdn-dark, #1976d2);
    margin-bottom: 0.1em;
}
.vendor-address {
    font-size: 0.97em;
    color: #444;
    margin-bottom: 0.1em;
}
.invoice-attachments-inline {
    display: flex;
    gap: 0.5em;
    margin-top: 0.5em;
    flex-wrap: wrap;
}
.attachment-link-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1em;
    height: 2.1em;
    border: none;
    border-radius: 50%;
    background: #f3f6fa;
    color: var(--rdn-dark, #1976d2);
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: none;
    cursor: pointer;
    padding: 0;
    outline: none;
    font-size: 1.2em;
}
.attachment-link-inline:hover, .attachment-link-inline:focus {
    background: #e3eafc;
    color: #0d47a1;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
}
.attachment-link-inline:active {
    background: #d2e3fc;
}
.invoice-lines-table tr:hover {
    background: #f5f8fc !important;
    transition: background 0.15s;
}
.status-header-icon {
    margin-right: 0.25em;
    vertical-align: middle;
}

.attachments-inline-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-top: 0.25em;
    margin-left: 1.5em;
    padding-bottom: 2px;
}
.attachment-pill {
    display: inline-flex;
    align-items: center;
    background: #f0f0f0;
    border-radius: 16px;
    padding: 2px 8px;
    font-size: 0.85em;
    color: #333;
    white-space: nowrap;
}
.attachment-pill i {
    margin-right: 4px;
    font-size: 1em;
}
.attachment-filename {
    font-size: 0.85em;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.header-attachments-row {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0;
    margin-left: 0;
    padding-bottom: 0;
    min-width: 0;
}
.attachment-pill {
    display: inline-flex;
    align-items: center;
    background: #f3f6fa;
    border-radius: 16px;
    padding: 2px 10px;
    font-size: 0.92em;
    color: #333;
    white-space: normal;
    box-shadow: 0 1px 4px rgba(2,62,44,0.06);
    transition: background 0.15s, box-shadow 0.15s;
    border: 1px solid #e0e7ef;
    max-width: 100%;
}
.attachment-filename {
    font-size: 0.92em;
    white-space: normal;
    word-break: break-all;
    display: inline-block;
    vertical-align: middle;
    max-width: 300px;
}

@media (max-width: 900px) {
    .approvals-table th, .approvals-table td {
        padding: 0.5em;
        font-size: 0.95em;
    }
    .content {
        padding: 1em;
    }
}

/* Responsive table → card layout for mobile */
@media (max-width: 600px) {
    .approvals-table {
        display: block;
        width: 100%;
        overflow-x: visible;
        border-radius: 0;
        box-shadow: none;
        border: none;
        margin-top: 0.75em;
        background: transparent;
    }
    .approvals-table thead {
        display: none;
    }
    .approvals-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75em;
    }
    /* Remove zebra striping — cards have their own background */
    .approvals-table tr.prod-row:nth-child(even) {
        background: #fff;
    }
    .approvals-table tr.prod-row:hover {
        background: #fff !important;
    }
    .approvals-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        background: #fff;
        border: 1px solid #e0e7ef;
        border-radius: 10px;
        box-shadow: 0 2px 6px rgba(2, 62, 44, 0.07);
        padding: 0.75em 0.85em 0.6em;
        position: relative;
    }
    .approvals-table td {
        display: flex;
        flex-direction: column;
        padding: 0.25em 0.3em;
        border: none;
        font-size: 0.95em;
        align-items: flex-start;
        justify-content: flex-start;
        position: relative;
        min-width: 0;
        max-width: none;
    }
    .approvals-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 0.75em;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin-bottom: 0.15em;
        flex: none;
    }
    /* Hide :before for cells with no data-label (checkbox, attachment) */
    .approvals-table td[data-label=""]:before {
        display: none;
    }
    /* Checkbox cell: full-width row above status, right-aligned */
    .approvals-table td.mobile-card-select {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        padding: 0.15em 0.2em;
        width: 100%;
        order: -2;
    }
    .approvals-table td.mobile-card-select input[type="checkbox"] {
        width: 22px;
        height: 22px;
        accent-color: var(--rdn-dark, #023E2C);
    }
    /* Status: full width as first row badge */
    .approvals-table td[data-label]:nth-child(2) {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        gap: 0.4em;
        padding-bottom: 0.4em;
        margin-bottom: 0.3em;
        border-bottom: 1px solid #f0f3f7;
    }
    .approvals-table td[data-label]:nth-child(2):before {
        display: none;
    }
    .status-text {
        font-size: 0.9em;
        font-weight: 600;
    }
    /* Document number: full width, prominent */
    .approvals-table td[data-label]:nth-child(3) {
        grid-column: 1 / -1;
        font-weight: 700;
        font-size: 1em;
        padding-bottom: 0.2em;
    }
    /* Vendor name: full width */
    .approvals-table td[data-label]:nth-child(4) {
        grid-column: 1 / -1;
        font-weight: 500;
        padding-bottom: 0.4em;
        margin-bottom: 0.2em;
        border-bottom: 1px solid #f0f3f7;
    }
    /* Amount fields: 2-column grid */
    .approvals-table td.text-end {
        text-align: left;
    }
    .approvals-table .currency-pill {
        font-size: 9px;
    }
    /* Attachment cell: inline in status row */
    .approvals-table td.mobile-card-attachment {
        position: absolute;
        top: 0.45em;
        right: 0.65em;
        padding: 0;
        width: auto;
        grid-column: unset;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .approvals-table td.mobile-card-attachment:before {
        display: none;
    }
    .attachment-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.3em;
    }
    /* Due date: full width footer */
    .approvals-table td[data-label]:last-of-type:not(.mobile-card-attachment):not(.mobile-card-select) {
        grid-column: 1 / -1;
    }
}

.text-end {
    text-align: right !important;
}
.text-center {
    text-align: center !important;
}
.text-start {
    text-align: left !important;
}

.modal-dialog.value-search-dialog {
    z-index: 1001;
    width: 420px;
    max-width: 95vw;
    background: var(--rdn-light);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(2,62,44,0.12);
    padding: 0;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    min-height: 220px;
    height: 560px;
    overflow: hidden;
}
.value-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--rdn-dark);
    color: var(--rdn-light);
    padding: 0.5em 1em;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
.value-search-title {
    font-size: 1em;
    font-weight: 600;
}
.value-search-close {
    background: none;
    border: none;
    color: var(--rdn-light);
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 0.5em;
}
.value-search-body {
    padding: 0.75em 1em 1em 1em;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.value-search-list-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.value-search-list {
    flex: 1 1 auto;
    overflow-y: auto;
    height: 100%;
    margin: 0;
    padding: 0;
}
.value-search-list-item {
    padding: 0.4em 0.7em;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--rdn-dark);
    transition: background 0.15s;
}
.value-search-list-item:hover {
    background: var(--rdn-accent);
    color: var(--rdn-light);
}
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2,62,44,0.18);
    z-index: 10
}

.compact-attachments-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-top: 0.25em;
    margin-left: 1.5em;
    padding-bottom: 2px;
    scrollbar-width: thin;
    scrollbar-color: #bdbdbd #f0f0f0;
}
.attachment-pill-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
}
.attachment-pill {
    display: inline-flex;
    align-items: center;
    background: #f3f6fa;
    border-radius: 16px;
    padding: 2px 10px;
    font-size: 0.92em;
    color: #333;
    white-space: normal;
    box-shadow: 0 1px 4px rgba(2,62,44,0.06);
    transition: background 0.15s, box-shadow 0.15s;
    border: 1px solid #e0e7ef;
}
.attachment-pill i {
    margin-right: 6px;
    font-size: 1em;
    color: var(--rdn-dark, #1976d2);
}
.attachment-pill-btn:hover .attachment-pill,
.attachment-pill-btn:focus .attachment-pill {
    background: #e3eafc;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
}
.col-description {
    min-width: 220px;
    max-width: 260px;
    width: 220px;
}

/* Pagination bar */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1em;
    padding: 0.75em 0.5em;
    margin-top: 0.5em;
    font-size: 0.95em;
    color: var(--rdn-dark, #023E2C);
}
.pagination-info {
    font-size: 0.93em;
    color: #555;
    white-space: nowrap;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25em;
}
.btn-page {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.35em 0.75em;
    font-size: 0.93em;
    color: var(--rdn-dark, #023E2C);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.btn-page:hover:not(:disabled) {
    background: #f3f6fa;
    border-color: #b0b8c0;
}
.btn-page.active {
    background: var(--rdn-dark, #023E2C);
    color: #fff;
    border-color: var(--rdn-dark, #023E2C);
    font-weight: 600;
}
.btn-page:disabled {
    opacity: 0.45;
    cursor: default;
}
.page-ellipsis {
    padding: 0 0.35em;
    color: #888;
    user-select: none;
}
.pagination-page-size {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.93em;
}
.pagination-page-size label {
    margin: 0;
    white-space: nowrap;
    color: #555;
}
.pagination-page-size select {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.3em 0.5em;
    font-size: 0.93em;
    color: var(--rdn-dark, #023E2C);
    background: #fff;
}
@media (max-width: 600px) {
    .pagination-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5em;
    }
    .pagination-controls {
        justify-content: center;
    }
}
/* Posted Approvals Table */
.posted-approvals-section {
    margin-top: 2em;
}

.posted-approvals-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.posted-approvals-table th {
    background: #f8f9fa;
    color: #1a1a1a;
    font-weight: 500;
    padding: 0.75em 1em;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.97em;
    white-space: nowrap;
}

.posted-approvals-table td {
    padding: 0.75em 1em;
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
    color: var(--rdn-dark, #222);
    vertical-align: middle;
}

.posted-approvals-table tbody tr:last-child td {
    border-bottom: none;
}

.posted-approvals-table tbody tr:hover {
    background: #f5f8fc;
}

.posted-approvals-table .pa-col-status {
    display: flex;
    align-items: center;
    gap: 0.5em;
    white-space: nowrap;
}

.posted-approvals-table th.pa-col-status {
    display: table-cell;
}

.posted-approvals-table .pa-col-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pa-status-approved {
    color: #4caf50;
    font-size: 1.15em;
}

.pa-status-rejected {
    color: #d32f2f;
    font-size: 1.15em;
}

.pa-status-pending {
    color: #bdbdbd;
    font-size: 1.15em;
}
