/* Make tables horizontally scrollable if they overflow their container */
.scrollable-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

/* Optional: Ensure table doesn't shrink below its content width */
.scrollable-table-wrapper table {
    min-width: 100%;
    width: max-content;
}

/* Layout overflow guard — grid shell handles sizing via MainLayout.razor.css */
.page main article.content {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}
body {
    background: var(--color-dark-green, #023E2C);
    color: var(--color-black, #000000);
    font-family: var(--font-body, 'IBM Plex Sans', sans-serif);
}

html, body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Legacy theme vars (for components not yet migrated to design-tokens) */
:root {
    --rdn-dark: #023E2C;
    --rdn-accent: #C8DD69;
    --rdn-light: #fff;
    --approved-green: #e6f9e6;
}

.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: 2em 0;
    /* box-shadow: 0 2px 8px rgba(2, 62, 44, 0.08); */
    padding: 2em;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
}

.home-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 100vw;
    padding: 0 1.25rem 1.5rem;
    min-height: calc(100vh - 3rem);
    overflow-x: hidden;
    box-sizing: border-box;
}

.home-table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin-top: 0.5rem;
    padding-bottom: 0.25rem;
}


.home-table-container .approvals-table {
    width: max-content;
    min-width: 100%;
}

.approvals-filters-pill {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.approvals-table, .invoice-lines-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(2, 62, 44, 0.08);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 2em;
}

.line-approved {
    background: var(--approved-green) !important;
}

.approvals-table th, .invoice-lines-table th {
    background: var(--rdn-dark);
    color: var(--rdn-light);
    font-weight: 600;
    padding: 1em 0.75em;
    text-align: left;
    border-bottom: 2px solid var(--rdn-accent);
    font-size: 1.05em;
}

.approvals-table td, .invoice-lines-table td {
    padding: 0.75em;
    border-bottom: 1px solid #e6e6e6;
    font-size: 1em;
    color: var(--rdn-dark);
}


.approvals-table tr.prod-row:hover, .invoice-lines-table tr:hover {
    background: var(--rdn-accent);
    color: var(--rdn-light);
    transition: background 0.2s, color 0.2s;
}

.approvals-table td:last-child,
.approvals-table th:last-child,
.invoice-lines-table td:last-child,
.invoice-lines-table th:last-child {
    text-align: right;
}

.approvals-table td, .invoice-lines-table td {
    vertical-align: middle;
}

.approvals-table .currency, .invoice-lines-table .currency {
    font-weight: bold;
    color: var(--rdn-accent);
}

.invoice-box {
    max-width: 1200px;
    min-width: 350px;
    margin: 0 auto 2em auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(2,62,44,0.10);
    padding: 2em 3em 2em 3em;
    border: 1.5px solid var(--rdn-dark);
    display: flex;
    flex-direction: column;
    gap: 2em;
}

.invoice-header {
    border-bottom: 2px solid var(--rdn-accent);
    margin-bottom: 1.5em;
    padding-bottom: 1em;
}

.invoice-header-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 0.5em;
}

.invoice-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 220px;
}

.invoice-totals {
    margin-top: 2em;
    padding: 1.2em 1em 1em 1em;
    background: #F6FFF0;
    border-radius: 8px;
    border: 1px solid #e6e6e6;
    max-width: 400px;
    width: 100%;
    font-size: 1.1em;
    margin-left: auto;
    margin-right: 0;
    float: none;
}

/* Content page title (used by Home, Posted, Comments, etc.) */
.content-page-header {
    color: var(--rdn-dark);
    margin: 2rem 0 1.5rem 0;
    font-weight: 600;
}

.invoice-totals div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5em;
}

.invoice-totals .invoice-total {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--rdn-dark);
    border-top: 2px solid var(--rdn-accent);
    padding-top: 0.5em;
    margin-top: 0.5em;
}

.invoice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75em;
    margin-top: 1.5em;
    margin-bottom: 1.5em;
}

.btn-approve {
    background: var(--rdn-accent);
    color: #fff;
    border: 1px solid var(--rdn-accent);
    border-radius: 8px;
    padding: 0.65em 1.6em;
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
}
.btn-approve:hover {
    background: #012f24;
    box-shadow: 0 2px 6px rgba(2, 62, 44, 0.25);
}
.btn-approve:disabled,
.btn-approve.disabled {
    background: #e4ebdf;
    border-color: #e4ebdf;
    color: #8a9284;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-reject {
    background: #f25b5b;
    color: #fff;
    border: 1px solid #e14a4a;
    border-radius: 8px;
    padding: 0.65em 1.6em;
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
}
.btn-reject:hover {
    background: #e14a4a;
    box-shadow: 0 2px 6px rgba(226, 90, 90, 0.25);
}
.btn-reject:disabled,
.btn-reject.disabled {
    background: #f4dada;
    border-color: #f4dada;
    color: #aa8f8f;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-delegate {
    background: #f6f8fb;
    color: #0f172a;
    border: 1px solid #e0e7ef;
    border-radius: 8px;
    padding: 0.65em 1.6em;
    font-size: 1.05em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.btn-delegate:hover {
    background: #eef2f7;
    color: #0b1525;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.vendor-name {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--rdn-accent);
    margin-bottom: 0.3em;
}

.invoice-comments-section {
    margin-top: 2em;
    background: #f9fafb;
    border-radius: 8px;
    padding: 1.5em 1.5em 1em 1.5em;
    box-shadow: 0 2px 8px rgba(2,62,44,0.06);
    border: 1px solid #e6e6e6;
    max-width: 900px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.invoice-comments-section h3 {
    margin-bottom: 1em;
    color: var(--rdn-dark);
}
.comments-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5em 0;
}
.comment-item {
    background: #fff;
    border-radius: 6px;
    margin-bottom: 1em;
    padding: 1em 1em 0.7em 1em;
    box-shadow: 0 1px 4px rgba(2,62,44,0.06);
    border-left: 4px solid var(--rdn-accent);
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.comment-item:hover {
    background: #f4f9ff;
    box-shadow: 0 4px 10px rgba(2,62,44,0.10);
    transform: translateY(-1px);
}
.comment-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.95em;
    color: #666;
    margin-bottom: 0.3em;
}
.comment-author {
    font-weight: 600;
    color: var(--rdn-dark);
}
.comment-date {
    font-style: italic;
}
.comment-body {
    font-size: 1.08em;
    color: var(--rdn-dark);
    margin-bottom: 0.2em;
}
.comment-input-row {
    display: flex;
    gap: 0.7em;
    margin-top: 1em;
}
.comment-input {
    flex: 1;
    border-radius: 6px;
    border: 1px solid #cfd8dc;
    padding: 0.7em 1em;
    font-size: 1em;
    outline: none;
    transition: border 0.2s;
}
.comment-input:focus {
    border: 1.5px solid var(--rdn-accent);
}
.btn-comment {
    background: var(--rdn-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.7em 1.5em;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-comment:hover {
    background: #5ea016;
}
.no-comments, .comment-loading {
    color: #888;
    font-style: italic;
    margin-bottom: 1em;
    text-align: center;
}

.invoice-attachments-section {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    background: #f4f8f4;
    border-radius: 8px;
    padding: 1.2em 1.5em 1em 1.5em;
    box-shadow: 0 1px 4px rgba(2,62,44,0.06);
    border: 1px solid #e6e6e6;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
.invoice-attachments-section h3 {
    margin-bottom: 0.7em;
    color: var(--rdn-dark);
}
.attachments-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.7em 1.5em;
}
.attachment-item {
    display: flex;
    align-items: center;
}
.attachment-link {
    background: none;
    border: none;
    color: var(--rdn-dark);
    font-size: 1.05em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    transition: background 0.15s;
}
.attachment-link:hover {
    background: var(--rdn-accent);
    color: #fff;
}
.attachment-filename {
    font-weight: 600;
}
.attachment-ext {
    font-size: 0.95em;
    color: #888;
    margin-left: 0.2em;
}

@media (max-width: 1200px) {
    .invoice-box {
        max-width: 98vw;
        padding: 1em 0.5em;
    }
    .invoice-comments-section {
        max-width: 98vw;
        padding: 1em 0.5em;
    }
    .invoice-totals {
        max-width: 98vw;
        padding: 1em 0.5em;
    }
}

@media (max-width: 900px) {
    .approvals-table th, .approvals-table td, .invoice-lines-table th, .invoice-lines-table td {
        padding: 0.5em;
        font-size: 0.95em;
    }
    .content, .invoice-box {
        padding: 1em;
    }
    .invoice-header-row {
        flex-direction: column;
        text-align: left;
    }
    .invoice-header-right {
        text-align: left;
        min-width: unset;
    }
    .invoice-totals {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    .invoice-comments-section {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

@media (max-width: 640px) {
    /* Layout shell is handled by MainLayout.razor.css —
       only non-layout overrides belong here */
    .content {
        padding: 0.5em !important;
        margin: 0.5em 0 !important;
    }
}

/* Make tables horizontally scrollable on overflow */
.scroll-x-table {
    width: 100%;
    display: block;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

/* Status Pill Styles */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.4em 0.8em;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 500;
    color: #fff;
}

.status-pill .icon {
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.4em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Specific status colors */
.status-approved {
    background: #28a745;
}
.status-pending {
    background: #ffc107;
}
.status-rejected {
    background: #dc3545;
}
.status-completed {
    background: #007bff;
}
.status-void {
    background: #6c757d;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA9Ty45NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwxMjAuNTYgOTkuNTYgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDg2IDYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjFaMDQgNzU2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgrODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Modal Styles for Attachment Viewer */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    pointer-events: auto;
}
.modal-dialog,
.value-search-dialog {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100 !important; /* much higher than backdrop */
    background: #fff;
    pointer-events: auto;
}
.modal-dialog-large {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100 !important;
    background: #fff;
    width: 90vw;
    height: 90vh;
    max-width: 1600px;
    max-height: 98vh;
    box-shadow: 0 8px 32px rgba(2,62,44,0.18);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-dialog-side {
    position: relative;
    width: 50vw;
    min-width: 45vw;
    max-width: 50vw;
    /*height: 100vh;*/
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0;
    border-radius: 0 8px 8px 0;
    z-index: 1100 !important;
    background: #fff;
    display: flex;
    flex-direction: column;
    right: 0;
    left: auto;
}
.modal-close {
    background: #1b2a56;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.2em 0.7em;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 1px 4px rgba(2,62,44,0.08);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 0.2em;
    position: relative;
}
.modal-close:hover {
    background: #142046;
}
.modal-toggle-size {
    background: var(--rdn-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.2em 0.7em;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 1px 4px rgba(2,62,44,0.08);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 0.2em;
    position: relative;
}
.modal-toggle-size:hover {
    background: #5ea016;
}
.modal-content-scroll {
    flex: 1 1 auto;
    overflow-y: auto !important;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
}
.modal-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(2,62,44,0.10);
}
.modal-pdf, modal-html {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(2,62,44,0.10);
    margin-top: 0;
}
.modal-unsupported {
    color: #d32f2f;
    font-weight: bold;
    font-size: 1.2em;
    text-align: center;
    margin-top: 2em;
}

/* Spinner Styles */
.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #78C51D;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
  display: block;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.invoice-attachment-flex {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    column-gap: 0.75rem;
    box-sizing: border-box;
}

/* Side-by-side modal should only take a portion of the screen */
.invoice-attachment-flex > .modal-dialog-side {
    flex: 0 0 45%;
    width: 45%;
    max-width: 45%;
    min-width: 0;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0;
    border-radius: 8px;
    z-index: auto;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* Ensure the invoice content takes the remaining space */
.invoice-attachment-flex > .invoice-box {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

/* Modal content scroll area fix for side-by-side */
.modal-content-scroll {
    flex: 1 1 0;
    overflow-y: auto !important;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
}

/* Responsive: stack modal below invoice on small screens */
@media (max-width: 900px) {
    .invoice-attachment-flex {
        flex-direction: column;
        height: auto;
        width: 100%;
        max-width: 100%;
    }
    .invoice-attachment-flex > .modal-dialog-side {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: 60vh;
        max-height: 70vh;
        border-radius: 0 0 8px 8px;
    }
}

/* Edit Button Modern Style */
.edit-btn-modern {
    background: #f3f6fa;
    color: var(--rdn-dark, #1976d2);
    border: 1.5px solid #e0e7ef;
    border-radius: 6px;
    padding: 0.3em 0.7em;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    margin-left: 0.5em;
    transition: background 0.18s, color 0.18s, border 0.18s, box-shadow 0.18s;
    box-shadow: 0 1px 4px rgba(2,62,44,0.06);
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}
.edit-btn-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f6fa;
    color: #bdbdbd;
    border: 1.5px solid #e0e7ef;
}
.edit-btn-modern:hover:not(:disabled),
.edit-btn-modern:focus:not(:disabled) {
    background: #e3eafc;
    color: #0d47a1;
    border: 1.5px solid var(--rdn-dark, #1976d2);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.10);
}

/* Save/Discard Buttons Modern Style */
.approval-actions-top {
    display: flex;
    gap: 1em;
    justify-content: flex-end;
    margin-bottom: 1.2em;
}
.btn-save-changes {
    background: #78C51D;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6em 1.8em;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s;
    box-shadow: 0 1px 4px rgba(2,62,44,0.08);
}
.btn-save-changes:hover {
    background: #5ea016;
}
.btn-discard-changes {
    background: #fff;
    color: #d32f2f;
    border: 1.5px solid #d32f2f;
    border-radius: 6px;
    padding: 0.6em 1.8em;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border 0.18s;
    box-shadow: 0 1px 4px rgba(2,62,44,0.08);
}
.btn-discard-changes:hover {
    background: #ffeaea;
    color: #a62828;
    border: 1.5px solid #a62828;
}

.topbar-shell {
     background: #f7fafc;
     border-bottom: 1px solid #e0e7ef;
     box-shadow: 0 1px 6px rgba(2, 62, 44, 0.08);
     display: flex;
     align-items: flex-start;
     gap: 1rem;
     flex-wrap: wrap;
     padding: 0.9rem 1.2rem;
 }

 .topbar-brand {
     min-width: 190px;
     display: flex;
     flex-direction: column;
     gap: 0.1rem;
 }

 .brand-title {
     font-weight: 700;
     font-size: 1.1rem;
     color: var(--rdn-dark);
 }

 .brand-subtitle {
     font-size: 0.9rem;
     color: #6b7280;
 }

 .topbar-pickers {
     flex: 1;
     display: flex;
     align-items: stretch;
     gap: 0.75rem;
     flex-wrap: wrap;
     min-width: 220px;
 }

 .topbar-actions {
     display: flex;
     align-items: center;
     gap: 0.5rem;
     flex-wrap: wrap;
 }

 .topbar-link {
     color: var(--rdn-dark);
     font-weight: 600;
     text-decoration: none;
     border: 1px solid #e0e7ef;
     padding: 0.45rem 0.8rem;
     border-radius: 8px;
     background: #fff;
     transition: all 0.15s ease;
 }

 .topbar-link:hover {
     color: var(--rdn-dark);
     background: #f0f4f8;
     box-shadow: 0 1px 6px rgba(2, 62, 44, 0.08);
 }

 .picker-card {
     background: #fff;
     border: 1px solid #e0e7ef;
     border-radius: 10px;
     padding: 0.55rem 0.75rem;
     display: flex;
     flex-direction: column;
     gap: 0.35rem;
     min-width: 190px;
     box-shadow: 0 1px 4px rgba(2, 62, 44, 0.05);
 }

 .picker-card .picker-select,
 .picker-card .form-control {
     width: 100%;
 }

 .picker-label {
     font-size: 0.78rem;
     text-transform: uppercase;
     letter-spacing: 0.05em;
     color: #6b7280;
     display: flex;
     align-items: center;
     gap: 0.35rem;
     font-weight: 700;
 }

 .picker-label i {
     color: var(--rdn-accent);
     font-size: 0.9rem;
 }

 .picker-value {
     font-size: 1rem;
     font-weight: 700;
     color: var(--rdn-dark);
     word-break: break-word;
 }

 .picker-muted {
     color: #9ca3af;
     font-weight: 500;
 }

 .picker-select {
     border: 1.5px solid #d5d9e2;
     border-radius: 10px;
     padding: 0.55rem 0.65rem;
     font-weight: 700;
     color: var(--rdn-dark);
     background: linear-gradient(180deg, #fff 0%, #f6f8fb 100%);
     min-height: 2.6rem;
     box-shadow: 0 2px 6px rgba(2, 62, 44, 0.06);
     transition: border 0.15s ease, box-shadow 0.15s ease;
 }

 .picker-select:focus {
     outline: none;
     border-color: var(--rdn-accent);
     box-shadow: 0 0 0 3px rgba(120, 197, 29, 0.18), 0 2px 6px rgba(2, 62, 44, 0.08);
 }

 .picker-select option {
     font-weight: 600;
     color: var(--rdn-dark);
     padding: 0.45rem 0.65rem;
     background: #fff;
 }

 .picker-select optgroup {
     font-weight: 700;
     color: #4b5563;
     background: #f0f4f8;
 }

/* Denial Reason Modal Styles */
.denial-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
}
.denial-modal-dialog {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2010;
    background: #fff;
    min-width: 340px;
    max-width: 95vw;
    width: 400px;
    box-shadow: 0 8px 32px rgba(2,62,44,0.18);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: denialModalFadeIn 0.2s ease;
}
@keyframes denialModalFadeIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}
.denial-modal-header {
    background: var(--rdn-accent);
    color: #fff;
    padding: 1.2em 1.5em 1em 1.5em;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    font-size: 1.3em;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.denial-modal-content {
    padding: 1.5em 1.5em 1em 1.5em;
    display: flex;
    flex-direction: column;
    gap: 1.2em;
}
.denial-modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}
.denial-modal-field label {
    font-weight: 500;
    color: var(--rdn-dark);
    margin-bottom: 0.2em;
}
.denial-modal-field select,
.denial-modal-field textarea {
    border: 1.5px solid #cfd8dc;
    border-radius: 6px;
    padding: 0.7em 1em;
    font-size: 1em;
    outline: none;
    transition: border 0.2s;
    background: #f9fafb;
    color: var(--rdn-dark);
}
.denial-modal-field select:focus,
.denial-modal-field textarea:focus {
    border: 1.5px solid var(--rdn-accent);
}
.denial-modal-actions {
    display: flex;
    gap: 1em;
    justify-content: flex-end;
    margin-top: 0.5em;
}
.denial-modal-btn {
    border: none;
    border-radius: 6px;
    padding: 0.7em 2em;
    font-size: 1.08em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 1px 4px rgba(2,62,44,0.08);
}
.denial-modal-btn-reject {
    background: #d32f2f;
    color: #fff;
}
.denial-modal-btn-reject:disabled {
    background: #e6e6e6;
    color: #aaa;
    cursor: not-allowed;
}
.denial-modal-btn-reject:not(:disabled):hover {
    background: #a62828;
}
.denial-modal-btn-cancel {
    background: #f3f6fa;
    color: var(--rdn-dark, #1976d2);
}
.denial-modal-btn-cancel:hover {
    background: #e0e7ef;
    color: #0d47a1;
}
 
/* Approval Processing Dialog Styles */
.approval-action-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.approval-action-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 1.5em 1.8em;
    min-width: 320px;
    max-width: 520px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.approval-action-dialog-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8em;
    font-size: 1.05em;
    color: var(--rdn-dark);
    font-weight: 600;
}

.approval-action-dialog-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.9em;
    font-size: 1.05em;
    color: var(--rdn-dark);
}

.dialog-success-icon,
.dialog-error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dialog-buttons {
    display: flex;
    gap: 0.8em;
    margin-top: 0.4em;
}

.btn-back-home {
    background: #1b2a56;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6em 1.2em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s;
    box-shadow: 0 1px 6px rgba(27, 42, 86, 0.18);
}

.btn-back-home:hover {
    background: #142046;
}

.btn-close-dialog {
    background: var(--rdn-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6em 1.2em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s;
    box-shadow: 0 1px 6px rgba(120, 197, 29, 0.18);
}

.btn-close-dialog:hover {
    background: #5ea016;
}

.comment-item {
    background: #fff;
    border-radius: 6px;
    margin-bottom: 1em;
    padding: 1em 1em 0.7em 1em;
    box-shadow: 0 1px 4px rgba(2,62,44,0.06);
    border-left: 4px solid var(--rdn-accent);
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.comment-item:hover {
    background: #f4f9ff;
    box-shadow: 0 4px 10px rgba(2,62,44,0.10);
    transform: translateY(-1px);
}
.comment-doc-link {
    color: var(--rdn-accent);
    font-weight: 700;
}
.comment-item:hover .comment-doc-link {
    text-decoration: underline;
}

/* Approval page sidebar for recent vendor invoices */
.approval-layout {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
}
.recent-vendor-panel {
    flex: 1 1 100%;
    max-width: 100%;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.9rem 0.85rem;
    box-shadow: 0 2px 10px rgba(2,62,44,0.06);
}
.recent-vendor-header {
    font-weight: 700;
    font-size: 0.98rem;
    color: #0f172a;
    margin-bottom: 0.6rem;
}
.recent-vendor-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.recent-vendor-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.65rem 0.7rem;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(15,23,42,0.05);
    transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    flex: 0 1 220px;
    min-width: 180px;
}
.recent-vendor-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15,23,42,0.12);
    border-color: #cbd5e1;
}
.recent-vendor-name {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.2rem;
    font-size: 0.98rem;
}
.recent-vendor-date {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}
.recent-vendor-amount {
    font-weight: 700;
    color: #023E2C;
    font-size: 1rem;
}
@media (max-width: 960px) {
    .recent-vendor-panel {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .recent-vendor-list {
        flex-direction: column;
    }
    .recent-vendor-card {
        flex: 1 1 100%;
    }
}

/* Visually hidden — accessible to screen readers only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Inline spinner for topbar selectors during loading */
.topbar-inline-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    color: #9ca3af;
    font-size: 1em;
}

/* Compact select for topbar tenant/company */
.topbar-compact-select {
    min-width: 120px;
    max-width: 220px;
    padding: 0.2em 0.7em;
    font-size: 1em;
    border-radius: 5px;
    border: 1px solid #bdbdbd;
    background: #fff;
    color: #023E2C;
    margin-right: 0.7em;
    margin-left: 0.2em;
    height: 2.1em;
    box-shadow: none;
    outline: none;
    transition: border 0.2s;
}
.topbar-compact-select:focus {
    border: 1.5px solid #78C51D;
}

/* ============================================
   MOBILE UX & ACCESSIBILITY ADDITIONS
   ============================================ */

/* AP-1.1: Skip to main content link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 9999;
    padding: 0.75em 1.5em;
    background: var(--rdn-dark, #023E2C);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 0;
}
.skip-link:focus {
    top: 0;
}

/* AP-1.6: Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* AP-14.3: Color contrast fixes — #888 fails WCAG AA (3.5:1), #595959 gives ~7:1 */
.vendor-no {
    color: #595959;
}

/* AP-6.6: Sticky approve/reject actions on mobile */
@media (max-width: 640px) {
    /* Loading indicator centered */
    .loading-indicator {
        text-align: center !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    /* Action buttons: stack vertically on mobile */
    .invoice-actions {
        position: sticky;
        bottom: 0;
        z-index: 50;
        background: #fff;
        padding: 0.75rem 0.85rem;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        margin: 0;
        flex-direction: column;
        gap: 0.5em;
    }
    .invoice-actions .btn-approve,
    .invoice-actions .btn-reject,
    .invoice-actions .btn-delegate {
        width: 100%;
        justify-content: center;
        padding: 0.7em 1em;
        font-size: 1em;
    }

    /* Invoice box: reduce padding, remove min-width */
    .invoice-box {
        min-width: 0 !important;
        padding: 0.75em 0.6em !important;
        margin: 0 !important;
        border-radius: 8px;
        gap: 1em;
    }

    /* Hide side-by-side toggle on mobile */
    .modal-toggle-size {
        display: none !important;
    }

    /* Invoice header: single column, left-align everything */
    .invoice-header-row {
        flex-direction: column !important;
        gap: 0.75em;
    }
    .invoice-header-right {
        align-items: flex-start !important;
        text-align: left !important;
        min-width: 0 !important;
    }

    /* Vendor info compact on mobile */
    .vendor-name {
        font-size: 1.1em;
    }
    .vendor-info-group {
        width: 100%;
    }

    /* Dimensions: left-aligned, full width */
    .invoice-dimension {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.3em;
        width: 100%;
    }

    /* Totals: full width on mobile */
    .invoice-totals {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0.85em 0.75em !important;
    }

    /* Attachment pills wrap */
    .compact-attachments-row {
        flex-wrap: wrap;
        gap: 0.4em;
    }

    /* Side-by-side: disable on mobile, stack with proper sizing */
    .invoice-attachment-flex {
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
    }
    .invoice-attachment-flex > .modal-dialog-side {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
        height: 50vh !important;
        max-height: 55vh !important;
        min-height: 200px !important;
        border-radius: 0 !important;
        order: -1;
    }
    .invoice-attachment-flex > .invoice-box {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    /* Comment input full-width */
    .comment-input-row {
        flex-direction: column;
        gap: 0.4em;
    }
    .comment-input {
        width: 100%;
    }
    .btn-comment {
        width: 100%;
    }

    /* Line bulk actions stack */
    .line-bulk-actions-row {
        padding: 0.5em;
    }
    .line-bulk-actions-btns {
        flex-direction: column;
        gap: 0.4em;
        width: 100%;
    }
    .line-bulk-actions-btns button {
        width: 100%;
    }

    /* AP-3.1 / AP-3.2: Topbar stacking on mobile */
    .topbar-shell {
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    .topbar-pickers-group {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        width: 100%;
    }
    .topbar-picker-item {
        flex: 1 1 0;
        min-width: 0;
    }
    .topbar-picker-item > i {
        font-size: 0.85em;
    }
    .topbar-actions {
        flex-wrap: wrap;
    }
    .topbar-compact-select {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        min-height: 44px;
        font-size: 0.85em;
    }

    /* AP-9.2: Comments section mobile padding */
    .invoice-comments-section {
        padding: 0.75em;
        margin: 0;
        max-width: 100%;
    }

    /* AP-12.2: Landing nav mobile padding */
    .landing-nav {
        padding: 16px 20px;
    }
}

/* AP-5.1: KPI cards stack on very small screens */
@media (max-width: 480px) {
    .kpi-card {
        min-width: 0;
        flex: 1 1 100%;
    }
}

/* KPI cards: add border on mobile so cards don't blend into background */
@media (max-width: 640px) {
    .kpi-card {
        border: 1px solid #e0e7ef;
        box-shadow: 0 2px 6px rgba(2, 62, 44, 0.08);
    }
}

/* AP-6.1: Mobile card layout refinements */
@media (max-width: 600px) {
    /* Remove wrapper border/shadow on mobile card view */
    .home-table-container,
    .scrollable-table-wrapper {
        overflow-x: visible;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    /* AP-7.7: Attachment pill touch targets */
    .attachment-pill-btn {
        min-height: 44px;
        padding: 0.5em;
    }

    /* Attachment loading indicator */
    .attachment-loading-indicator {
        display: flex;
        align-items: center;
        gap: 0.5em;
        padding: 0.25em 0.5em;
    }

    /* AP-8.2: Pagination touch targets */
    .btn-page {
        padding: 0.5em 1em;
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Mobile select-all bar: hidden on desktop, shown on mobile */
.mobile-select-all-bar {
    display: none;
}
@media (max-width: 600px) {
    .mobile-select-all-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.6em 0.85em;
        background: #fff;
        border: 1px solid #e0e7ef;
        border-radius: 10px;
        margin-top: 0.75em;
        box-shadow: 0 1px 4px rgba(2, 62, 44, 0.05);
    }
    .mobile-select-all-label {
        display: flex;
        align-items: center;
        gap: 0.5em;
        font-weight: 600;
        font-size: 0.95em;
        color: var(--rdn-dark, #023E2C);
        cursor: pointer;
        margin: 0;
    }
    .mobile-select-all-label input[type="checkbox"] {
        width: 22px;
        height: 22px;
        accent-color: var(--rdn-dark, #023E2C);
    }
    .mobile-selected-count {
        background: var(--rdn-dark, #023E2C);
        color: #fff;
        font-weight: 700;
        font-size: 0.85em;
        border-radius: 1em;
        padding: 0.2em 0.65em;
        min-width: 1.5em;
        text-align: center;
    }
}

/* AP-7.3: Edit button touch targets on mobile */
@media (max-width: 640px) {
    .edit-btn-modern {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5em;
        justify-content: center;
    }
}

/* AP-11.3: Denial dialog max-height on mobile */
@media (max-width: 640px) {
    .denial-modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
        max-width: 95vw;
    }
}

/* Language ring switch styles */
.lang-ring-switch {
    display: flex;
    align-items: center;
    gap: 0.2em;
    background: #fff;
    border-radius: 2em;
    padding: 0.15em 0.5em;
    box-shadow: 0 1px 4px rgba(2,62,44,0.07);
    border: 1px solid #e0e0e0;
}
.lang-ring-item {
    border: none;
    background: none;
    color: #023E2C;
    font-weight: 600;
    font-size: 1em;
    border-radius: 50%;
    width: 2.1em;
    height: 2.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    outline: none;
}
.lang-ring-item.active {
    background: #78C51D;
    color: #fff;
    box-shadow: 0 0 0 2px #78C51D33;
}
.lang-ring-item:focus {
    outline: 2px solid #78C51D;
}
.lang-ring-sep {
    color: #bdbdbd;
    font-weight: bold;
    font-size: 1.1em;
    padding: 0 0.2em;
}

/* Language flag toggle styles */
.lang-flag-toggle {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 2em;
    padding: 0.15em 0.7em;
    box-shadow: 0 1px 4px rgba(2,62,44,0.07);
    border: 1px solid #e0e0e0;
    cursor: pointer;
    border-width: 1.5px;
    font-size: 1.25em;
    transition: border 0.18s;
    height: 2.5em;
}
.lang-flag-toggle:focus {
    outline: 2px solid #78C51D;
}
.lang-flag-img {
    width: 2em;
    height: 2em;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #78C51D33;
    object-fit: cover;
    transition: box-shadow 0.18s;
}

/* Bulk line approval/decline actions */
.line-bulk-actions-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}
.line-bulk-actions-btns {
    display: flex;
    gap: 0.75em;
}
.btn-line-approve, .btn-line-decline {
    padding: 0.4em 1.2em;
    font-size: 1em;
    border-radius: 5px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 4px #0001;
}
.btn-line-approve {
    background: #4caf50;
    color: #fff;
}
.btn-line-decline {
    background: #d32f2f;
    color: #fff;
}

/* Tenant selector icon styling */
.tenant-selector-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}
.fa-tenant-icon, fa-company-icon {
    color: var(--rdn-dark);
    font-size: 1.25em;
    opacity: 0.85;
}

/* ── Mobile search bar (visible only on mobile, positioned in header) ── */
.mobile-search-bar {
    display: none;
}

@media (max-width: 640px) {
    .mobile-search-bar {
        display: flex;
        align-items: center;
        position: fixed;
        top: 44px;
        left: 16px;
        right: 16px;
        height: 36px;
        padding: 0 12px;
        background: #ffffff;
        border-radius: var(--radius-pill, 18px);
        gap: 8px;
        z-index: 101;
    }

    .mobile-search-icon {
        font-size: 14px;
        color: rgba(0, 0, 0, 0.4);
        flex-shrink: 0;
    }

    .mobile-search-input {
        border: none;
        background: transparent;
        outline: none;
        font-family: var(--font-body, 'IBM Plex Sans', sans-serif);
        font-size: 13px;
        color: #000;
        width: 100%;
        padding: 0;
    }

    .mobile-search-input::placeholder {
        color: rgba(0, 0, 0, 0.4);
    }
}