/* ==========================================================================
   Evie by Clear Code — Light Design System
   Global CSS Custom Properties & Component Classes
   ========================================================================== */

/* ---------- Google Fonts (loaded in App.razor via <link>) ---------- */

:root {
    /* --- Backgrounds & Surfaces --- */
    --evie-bg: #FFFFFF;
    --evie-surface: #FFFFFF;
    --evie-surface-hover: #F5F5F5;
    --evie-card: #FFFFFF;
    --evie-border: #E5E5E5;
    /* --- Brand & Action --- */
    --evie-primary: #C06820;
    --evie-primary-hover: #A85818;
    --evie-primary-muted: rgba(192, 104, 32, 0.12);
    --evie-coral: #DC4A3A;
    --evie-coral-muted: rgba(220, 74, 58, 0.10);
    --evie-verified: #16A34A;
    --evie-verified-muted: #F0FDF4;
    --evie-warning: #D97706;
    --evie-warning-muted: #FFFBEB;
    /* --- Semantic Aliases --- */
    --evie-approved: #16A34A;
    --evie-approved-muted: #F0FDF4;
    --evie-error: #DC2626;
    --evie-error-muted: #FEF2F2;
    /* --- Text --- */
    --evie-text: #1A1A1A;
    --evie-text-muted: #6B6B6B;
    --evie-text-dim: #9CA3AF;
    /* --- Additional --- */
    --evie-link-hover: #A85818;
    --evie-secondary-hover: #F0F0F0;
    --evie-page-gradient-stop: #FAFAFA;
    /* --- Header --- */
    --evie-header-bg: #C06820;
    --evie-header-text: #FFFFFF;
    /* --- Typography --- */
    --font-sans: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-mono: 'Geist Mono', monospace;
}

/* ---------- Global Reset & Base ---------- */

*, *::before, *::after {
    box-sizing: border-box;
    border-color: var(--evie-border);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 14px;
    line-height: 1.5;
    color: var(--evie-text);
    background-color: var(--evie-bg);
    font-feature-settings: "rlig" 1, "calt" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
}

h1:focus {
    outline: none;
}

p {
    margin: 0 0 1rem 0;
}

a {
    color: var(--evie-primary);
    text-decoration: none;
    transition: color 150ms;
}

a:hover {
    color: var(--evie-link-hover);
}

:focus-visible {
    outline: 2px solid var(--evie-primary);
    outline-offset: 2px;
}

/* ---------- Page Background ---------- */

.evie-page-bg {
    background-color: var(--evie-bg);
    min-height: 100vh;
}

/* ---------- Utility Classes ---------- */

.evie-surface {
    background-color: var(--evie-surface);
    border: 1px solid var(--evie-border);
    border-radius: 0.75rem;
}

.evie-section-title {
    font-weight: 600;
    color: var(--evie-text);
}

.evie-subtle {
    color: var(--evie-text-muted);
}

.font-mono {
    font-family: var(--font-mono);
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background-color 150ms, border-color 150ms;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--evie-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--evie-primary-hover);
}

.btn-secondary {
    background-color: var(--evie-surface-hover);
    color: var(--evie-text);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--evie-secondary-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--evie-text-muted);
    border: 1px solid var(--evie-border);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--evie-surface);
    color: var(--evie-text);
}

.btn-destructive {
    background-color: transparent;
    color: var(--evie-coral);
    border: 1px solid var(--evie-coral-muted);
}

.btn-destructive:hover:not(:disabled) {
    background-color: var(--evie-coral-muted);
}

/* ---------- Form Inputs ---------- */

.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--evie-border);
    border-radius: 0.5rem;
    background-color: var(--evie-card);
    color: var(--evie-text);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.5;
    transition: border-color 150ms, box-shadow 150ms;
}

.input::placeholder {
    color: var(--evie-text-dim);
}

.input:focus {
    outline: none;
    border-color: var(--evie-primary);
    box-shadow: 0 0 0 1px var(--evie-primary);
}

.input-compact {
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

.input-error {
    border-color: var(--evie-coral);
}

.input-error:focus {
    border-color: var(--evie-coral);
    box-shadow: 0 0 0 1px var(--evie-coral);
}

/* ---------- Labels ---------- */

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--evie-text-muted);
    margin-bottom: 0.25rem;
}

.label-compact {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--evie-text-dim);
    margin-bottom: 0.125rem;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: var(--evie-verified-muted);
    color: var(--evie-verified);
}

.badge-warning {
    background-color: var(--evie-warning-muted);
    color: var(--evie-warning);
}

.badge-error {
    background-color: var(--evie-coral-muted);
    color: var(--evie-coral);
}

.badge-info {
    background-color: var(--evie-primary-muted);
    color: var(--evie-primary);
}

.badge-dim {
    background-color: rgba(110, 115, 136, 0.15);
    color: var(--evie-text-dim);
}

/* ---------- Cards ---------- */

.card {
    background-color: var(--evie-card);
    border: 1px solid var(--evie-border);
    border-radius: 0.75rem;
    /*padding: 1.5rem;*/
}

/* ---------- Validation ---------- */

.validation-message {
    color: var(--evie-coral);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.valid.modified:not([type=checkbox]) {
    outline: none;
}

.invalid {
    outline: 1px solid var(--evie-coral);
}

/* ---------- Blazor Error UI ---------- */

#blazor-error-ui {
    background: var(--evie-surface);
    border-top: 2px solid var(--evie-coral);
    color: var(--evie-text);
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--evie-coral-muted);
    border: 1px solid var(--evie-coral);
    padding: 1rem;
    border-radius: 0.5rem;
    color: var(--evie-coral);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ---------- Animations ---------- */

@keyframes evie-slide-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* `backwards`, not `both`: forwards-fill keeps this element a *target* of a
   transform animation even after it finishes, and a transform-animated element
   is a containing block for position:fixed descendants even when its current
   transform value is none. That would trap modals/overlays inside this element
   instead of the viewport. `backwards` preserves the entrance (start hidden +
   slide in) but releases the effect once the animation ends — and the end state
   already equals the resting state, so there's no visual snap. */
.animate-evie-slide-up {
    animation: evie-slide-up 350ms ease-out backwards;
}

@keyframes evie-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: evie-spin 1s linear infinite;
}

/* ---------- Page Titles ---------- */

.page-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--evie-text);
    margin-bottom: 1.5rem;
}

/* ---------- Apryse PDF Viewer ---------- */

.apryse-viewer-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.viewer-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--evie-bg);
}

.viewer-header {
    flex-shrink: 0;
    background-color: var(--evie-surface);
    border-bottom: 1px solid var(--evie-border);
    padding: 0.75rem 1rem;
}

.viewer-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.viewer-back-link {
    font-size: 0.875rem;
    color: var(--evie-text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.viewer-back-link:hover {
    color: var(--evie-primary);
}

.viewer-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewer-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--evie-text);
    margin: 0;
}

.viewer-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.viewer-area {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.viewer-wrapper {
    position: absolute;
    inset: 0;
}

.viewer-sidebar {
    flex-shrink: 0;
    width: 320px;
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid var(--evie-border);
    padding: 1rem;
    background-color: var(--evie-surface);
}

@media (max-width: 1023px) {
    .viewer-sidebar {
        display: none;
    }
}

/* Viewer error state */

.viewer-error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}

.viewer-error-content {
    text-align: center;
    max-width: 400px;
}

.viewer-error-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    color: var(--evie-warning);
}

.viewer-error-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--evie-text);
    margin-bottom: 0.5rem;
}

.viewer-error-message {
    font-size: 0.875rem;
    color: var(--evie-text-muted);
    margin-bottom: 1.5rem;
}

/* Viewer loading state */

.viewer-loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 100%;
    color: var(--evie-text-muted);
    font-size: 0.875rem;
}

.viewer-loading-message {
    color: var(--evie-text-muted);
}

/* ---------- Metadata Panel ---------- */

.metadata-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metadata-panel-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.metadata-panel-fields {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* ---------- Editable Field ---------- */

.editable-field {
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--evie-border);
    cursor: default;
}

.editable-field:last-child {
    border-bottom: none;
}

.editable-field-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--evie-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.125rem;
}

.editable-field-display {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 1.5rem;
}

.editable-field-value {
    font-size: 0.875rem;
    color: var(--evie-text);
}

.editable-field-pencil {
    opacity: 0;
    font-size: 0.75rem;
    color: var(--evie-text-dim);
    cursor: pointer;
    transition: opacity 150ms;
}

.editable-field:hover .editable-field-pencil {
    opacity: 1;
}

.editable-field-pencil:hover {
    color: var(--evie-primary);
}

.editable-field-confidence-warn {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--evie-warning);
    background-color: var(--evie-warning-muted);
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.editable-field-low-confidence .editable-field-value {
    color: var(--evie-warning);
}

.editable-field-edit {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.editable-field-edit .input {
    flex: 1;
    min-width: 0;
}

.editable-field-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    background: transparent;
    color: var(--evie-text-muted);
    transition: background-color 150ms, color 150ms;
}

.editable-field-save:hover {
    background-color: var(--evie-verified-muted);
    color: var(--evie-verified);
}

.editable-field-cancel:hover {
    background-color: var(--evie-coral-muted);
    color: var(--evie-coral);
}

.editable-field-error {
    font-size: 0.75rem;
    color: var(--evie-coral);
    margin-top: 0.125rem;
}

/* ---------- Line Items Table ---------- */

.line-items-section {
    margin-top: 0.5rem;
}

.line-items-header {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--evie-text);
    margin-bottom: 0.5rem;
}

.line-items-table-wrapper {
    overflow-x: auto;
}

.line-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.line-items-table th {
    font-weight: 500;
    color: var(--evie-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.625rem;
    padding: 0.375rem 0.25rem;
    border-bottom: 1px solid var(--evie-border);
    text-align: left;
    white-space: nowrap;
}

.line-items-table td {
    padding: 0.25rem;
    border-bottom: 1px solid var(--evie-border);
    vertical-align: top;
}

.line-items-table tr:nth-child(even) {
    background-color: var(--evie-bg);
}

.line-item-num {
    color: var(--evie-text-dim);
    font-size: 0.6875rem;
}

.text-right {
    text-align: right;
}

/* ---------- Extraction Badge ---------- */

.extraction-badge {
    font-size: 0.75rem;
    color: var(--evie-text-dim);
    line-height: 1.4;
}

.extraction-badge-chain {
    color: var(--evie-text-muted);
}

.extraction-badge-cost {
    color: var(--evie-text-dim);
}

.extraction-badge-reasons {
    margin-top: 0.25rem;
}

.extraction-badge-reason {
    display: block;
    font-size: 0.6875rem;
    color: var(--evie-warning);
}

/* ---------- Attention Banner ---------- */

.attention-banner {
    background-color: var(--evie-warning-muted);
    border: 1px solid var(--evie-warning);
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
}

.attention-banner-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--evie-warning);
    display: block;
    margin-bottom: 0.25rem;
}

.attention-banner-list {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.75rem;
    color: var(--evie-text);
}

.attention-banner-list li {
    margin-bottom: 0.125rem;
}

/* ---------- Viewer Navigation ---------- */

.viewer-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.viewer-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--evie-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-family: var(--font-sans);
}

.viewer-nav-btn:hover {
    background-color: var(--evie-surface-hover);
}

.viewer-nav-btn.disabled {
    color: var(--evie-text-dim);
    cursor: default;
    pointer-events: none;
}

.viewer-nav-position {
    font-size: 0.8125rem;
    color: var(--evie-text-muted);
    white-space: nowrap;
}

/* ---------- Split Viewer ---------- */

.split-viewer {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.split-viewer-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.split-viewer-pane:first-child {
    border-right: 1px solid var(--evie-border);
}

.split-viewer-label {
    flex-shrink: 0;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--evie-text-muted);
    background-color: var(--evie-surface);
    border-bottom: 1px solid var(--evie-border);
}

.split-viewer-content {
    flex: 1;
    min-height: 0;
    position: relative;
}

/* ---------- Shared Toolbar ---------- */

.shared-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--evie-surface);
    border-bottom: 1px solid var(--evie-border);
}

.shared-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--evie-text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: var(--font-sans);
}

.shared-toolbar-btn:hover {
    background-color: var(--evie-surface-hover);
    color: var(--evie-text);
}

.shared-toolbar-btn.active {
    background-color: var(--evie-primary);
    color: white;
}

.shared-toolbar-divider {
    width: 1px;
    height: 1.25rem;
    background-color: var(--evie-border);
    margin: 0 0.25rem;
}

/* ---------- Tabbed Viewer (Mobile) ---------- */

.tabbed-viewer-tabs {
    display: flex;
    border-bottom: 1px solid var(--evie-border);
}

.tabbed-viewer-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    background: none;
    color: var(--evie-text-muted);
    border-bottom: 2px solid transparent;
}

.tabbed-viewer-tab.active {
    color: var(--evie-primary);
    font-weight: 600;
    border-bottom-color: var(--evie-primary);
    background-color: var(--evie-surface);
}

/* Responsive: split on desktop, tabs on mobile */
@media (min-width: 1024px) {
    .split-viewer-desktop { display: flex; }
    .tabbed-viewer-mobile { display: none !important; }
}

@media (max-width: 1023px) {
    .split-viewer-desktop { display: none !important; }
    .tabbed-viewer-mobile { display: flex !important; }
}

/* ---------- Package Panel ---------- */

.package-section {
    margin-bottom: 1.25rem;
}

.package-section-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--evie-text-muted);
    margin-bottom: 0.5rem;
}

.packing-slip-card {
    padding: 0.625rem;
    background-color: var(--evie-bg);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
}

.packing-slip-card-title {
    font-weight: 500;
    color: var(--evie-text);
}

.packing-slip-card-vendor,
.packing-slip-card-date {
    font-size: 0.75rem;
    color: var(--evie-text-muted);
}

.match-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.match-status-complete {
    background-color: var(--evie-verified-muted);
    color: var(--evie-verified);
}

.match-status-partial {
    background-color: var(--evie-warning-muted);
    color: var(--evie-warning);
}

/* Match Info */

.match-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.match-info-label {
    color: var(--evie-text-muted);
}

.match-info-reasons {
    margin-top: 0.375rem;
}

.match-info-reason {
    display: block;
    font-size: 0.75rem;
    color: var(--evie-text-dim);
    padding-left: 0.5rem;
}

/* Line Satisfaction */

.line-satisfaction-item {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
}

.line-satisfied {
    color: var(--evie-verified);
}

.line-unsatisfied {
    color: var(--evie-warning);
}

.line-match-ref {
    font-size: 0.75rem;
    color: var(--evie-text-dim);
}

/* Workflow Status */

.workflow-stamp-entry {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
}

.workflow-stamp-icon {
    font-size: 0.75rem;
}

.workflow-stamp-label {
    font-weight: 600;
    font-size: 0.75rem;
}

.workflow-verified .workflow-stamp-icon,
.workflow-verified .workflow-stamp-label {
    color: var(--evie-primary);
}

.workflow-approved .workflow-stamp-icon,
.workflow-approved .workflow-stamp-label {
    color: var(--evie-verified);
}

.workflow-entered .workflow-stamp-icon,
.workflow-entered .workflow-stamp-label {
    color: var(--evie-warning);
}

.workflow-stamp-meta {
    font-size: 0.75rem;
    color: var(--evie-text-dim);
}

/* ---------- Workflow Stamp Button ---------- */

.workflow-stamp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-sans);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.1s;
}

.workflow-stamp-btn:hover:not(:disabled) {
    transform: scale(1.02);
}

.workflow-stamp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.workflow-stamp-btn.verify {
    background-color: var(--evie-verified);
    color: white;
}

.workflow-stamp-btn.approve {
    background-color: var(--evie-primary);
    color: white;
}

.workflow-status-label {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
}

.workflow-status-label.ready {
    background-color: var(--evie-warning-muted);
    color: var(--evie-warning);
}

.workflow-status-label.entered {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--evie-text-muted);
}

.stamp-error {
    margin-top: 0.5rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--evie-coral);
    background-color: var(--evie-coral-muted);
    border-radius: 4px;
}

/* ---------- Document Stamp Toolbar ---------- */

.doc-stamp-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--evie-border);
    margin-top: 0.75rem;
}

.doc-stamp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.doc-stamp-btn.verified {
    color: var(--evie-verified);
    border-color: var(--evie-verified);
}

.doc-stamp-btn.verified:hover {
    background-color: var(--evie-verified-muted);
}

.doc-stamp-btn.approved {
    color: var(--evie-primary);
    border-color: var(--evie-primary);
}

.doc-stamp-btn.approved:hover {
    background-color: var(--evie-primary-muted);
}

.save-pdf-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    border: 1px solid var(--evie-border);
    border-radius: 4px;
    cursor: pointer;
    background: none;
    color: var(--evie-text);
}

.save-pdf-btn:hover {
    background-color: var(--evie-surface-hover);
}

.save-pdf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.save-pdf-btn.unsaved {
    border-color: var(--evie-warning);
    color: var(--evie-warning);
}

/* ---------- Modal Dialog ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.25rem 1.25rem 0.75rem;
    font-size: 1.0625rem;
    font-weight: 500;
}

.modal-body {
    padding: 0 1.25rem;
    font-size: 0.875rem;
    color: var(--evie-text-muted);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.25rem;
}

/* Reprocess modal */

.reprocess-issues {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.reprocess-issue-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.reprocess-issue-label input[type="checkbox"] {
    accent-color: var(--evie-primary);
}

.reprocess-details {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--evie-border);
    border-radius: 4px;
    font-size: 0.8125rem;
    resize: vertical;
    min-height: 3rem;
    font-family: inherit;
}

/* Panel footer actions */

.panel-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--evie-border);
}

.action-btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: 1px solid var(--evie-border);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    color: var(--evie-text);
}

.action-btn-outline:hover {
    background-color: var(--evie-surface-hover);
}

.action-btn-outline.destructive {
    color: var(--evie-coral);
    border-color: var(--evie-coral);
}

.action-btn-outline.destructive:hover {
    background-color: var(--evie-coral-muted);
}

.action-btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---------- AP Matching Hub ---------- */

.ap-hub-header {
    margin-bottom: 1.5rem;
}

.ap-hub-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--evie-text-dim);
}

.ap-hub-title {
    font-size: 1.375rem;
    font-weight: 400;
    color: var(--evie-text);
    margin-top: 0.25rem;
}

.ap-hub-subtitle {
    font-size: 0.875rem;
    color: var(--evie-text-muted);
    margin-top: 0.25rem;
}

.ap-hub-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .ap-hub-grid {
        grid-template-columns: 1fr;
    }
}

.ap-hub-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background-color: var(--evie-card);
    border: 1px solid var(--evie-border);
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--evie-text);
    transition: border-color 150ms, box-shadow 150ms;
    position: relative;
}

.ap-hub-card:hover {
    border-color: var(--evie-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ap-hub-card-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.ap-hub-card-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.ap-hub-card-icon.intake {
    background-color: var(--evie-primary-muted);
    color: var(--evie-primary);
}

.ap-hub-card-icon.verification {
    background-color: var(--evie-verified-muted);
    color: var(--evie-verified);
}

.ap-hub-card-icon.approval {
    background-color: var(--evie-primary-muted);
    color: var(--evie-primary);
}

.ap-hub-card-icon.payment {
    background-color: var(--evie-warning-muted);
    color: var(--evie-warning);
}

.ap-hub-card-title {
    font-size: 1.0625rem;
    font-weight: 500;
    margin: 0;
}

.ap-hub-card-count {
    margin-left: auto;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--evie-text-dim);
}

.ap-hub-card-count.has-items {
    color: var(--evie-primary);
}

.ap-hub-card-desc {
    font-size: 0.8125rem;
    color: var(--evie-text-muted);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.ap-hub-card-stats {
    display: flex;
    gap: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--evie-border);
    margin-top: auto;
}

.ap-hub-stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.ap-hub-stat-label {
    font-size: 0.5625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--evie-text-dim);
}

.ap-hub-stat-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--evie-text);
}

.ap-hub-card-arrow {
    position: absolute;
    right: 1.25rem;
    bottom: 1rem;
    font-size: 1.25rem;
    color: var(--evie-text-dim);
}
/* ---------- AP Matching Workspace ---------- */

.ap-workspace {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* Stats Bar */

.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.75rem 1.25rem;
    background-color: var(--evie-surface);
    border: 1px solid var(--evie-border);
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    text-decoration: none;
}

.stat-link:hover .stat-value {
    color: var(--evie-primary);
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--evie-text);
}

.stat-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--evie-text-dim);
}

.stat-divider {
    width: 1px;
    height: 2rem;
    background-color: var(--evie-border);
}

/* Workspace Sections */

.workspace-section {
    margin-bottom: 1.25rem;
}

.workspace-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.workspace-empty-section {
    font-size: 0.8125rem;
    color: var(--evie-text-dim);
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.workspace-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--evie-text-dim);
    font-size: 0.875rem;
}

.workspace-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    color: var(--evie-text-muted);
}

/* Filter Tabs */

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--evie-border);
    margin-bottom: 0.75rem;
    overflow-x: auto;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    font-weight: 500;
    color: var(--evie-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.filter-tab:hover {
    color: var(--evie-text);
}

.filter-tab.active {
    color: var(--evie-primary);
    border-bottom-color: var(--evie-primary);
}

.filter-count {
    font-size: 0.6875rem;
    background-color: var(--evie-bg);
    padding: 0.0625rem 0.375rem;
    border-radius: 999px;
}

/* Classified Document Lanes */

.classified-lanes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 1023px) {
    .classified-lanes {
        grid-template-columns: 1fr;
    }
}

.classified-lane {
    min-height: 100px;
}

.lane-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.lane-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--evie-text-muted);
}

.lane-empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--evie-text-dim);
    background-color: var(--evie-bg);
    border-radius: 6px;
}

.classified-card {
    display: block;
    padding: 0.75rem;
    background-color: var(--evie-bg);
    border: 1px solid var(--evie-border);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: var(--evie-text);
    transition: border-color 150ms;
}

.classified-card:hover {
    border-color: var(--evie-primary);
}

.classified-card-vendor {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.classified-card-detail {
    font-size: 0.75rem;
    color: var(--evie-text-muted);
}

.classified-card-amount {
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.classified-card-footer {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

/* Workspace Action Bar */

.workspace-action-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.workspace-action-result {
    font-size: 0.875rem;
    color: var(--evie-verified);
}

.workspace-action-result.error {
    color: var(--evie-coral);
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

/* ---------- Auth Forms (shared across Login / ForgotPassword / ChangePassword / ResetPassword) ---------- */

.auth-title {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 700;
    color: #1C0E04;
    line-height: 1.15;
    margin: 0 0 6px 0;
}

.auth-description {
    font-size: 13px;
    font-weight: 300;
    color: #A08060;
    line-height: 1.5;
    margin: 0 0 36px 0;
}

.auth-error {
    background-color: rgba(220, 74, 58, 0.1);
    color: #DC2626;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.auth-success {
    background-color: rgba(22, 163, 74, 0.1);
    color: #16A34A;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.auth-hint {
    font-size: 0.8125rem;
    color: #6B6B6B;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.auth-field {
    margin-bottom: 26px;
}

.auth-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #B09070;
    margin-bottom: 8px;
    font-weight: 500;
}

.auth-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid #D4C0A8;
    border-radius: 0;
    padding: 8px 0 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: #1C0E04;
    outline: none;
    transition: border-color 200ms;
    caret-color: #C06820;
}

.auth-input::placeholder {
    color: #C8B090;
    font-weight: 300;
}

.auth-input:focus {
    border-bottom-color: #C06820;
}

.auth-forgot-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -12px;
    margin-bottom: 32px;
}

.auth-forgot-link {
    font-family: var(--font-mono);
    font-size: 8.5px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #B09070;
    text-decoration: none;
    transition: color 150ms;
    font-weight: 500;
}

.auth-forgot-link:hover {
    color: #C06820;
}

.auth-back-link {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-link {
    color: #C06820;
    text-decoration: none;
    word-break: break-all;
}

.auth-link:hover {
    color: #A85818;
}

.auth-submit {
    display: block;
    width: 100%;
    background: #C06820;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    padding: 13px 20px;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(192, 104, 32, 0.22);
    transition: background 180ms, box-shadow 180ms, transform 120ms;
}

.auth-submit:hover:not(:disabled) {
    background: #A85818;
    box-shadow: 0 6px 20px rgba(192, 104, 32, 0.32);
    transform: translateY(-1px);
    color: #FFFFFF;
}

.auth-submit:active:not(:disabled) {
    transform: translateY(0);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ---------- Shared utilities (consolidated from scoped CSS) ---------- */

.text-primary {
    color: var(--evie-text);
    font-weight: 500;
}

.text-dim { color: var(--evie-text-dim); font-size: 0.75rem; }

.action-error {
    color: var(--evie-coral);
    font-size: 0.75rem;
}

.data-table { width: 100%; border-collapse: collapse; }

/* Order Entry loading / empty-state container (shared by Review + Sent).
   Page-specific tweaks like the empty-state <h2> margin stay scoped. */
.oe-loading,
.oe-empty {
    padding: 3rem 2.5rem;
    color: #6B6B6B;
}
