/* CSS Variables (themes.css overrides font/header vars when data-theme is set) */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-primary: #dce5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8f0fe;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-focus: #2563eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --h1-size: 2rem;
    --h2-size: 1.5rem;
    --h3-size: 1.25rem;
    --h1-weight: 700;
    --h2-weight: 600;
    --h3-weight: 600;
    --heading-letter-spacing: 0;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Set background on html so Edge (and others) paint the viewport the same as Chrome */
html {
    background: #dce5f5;
    background: var(--bg-primary, #dce5f5);
}

body {
    font-family: var(--font-body);
    background: #dce5f5;
    background: var(--bg-primary, #dce5f5);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 3rem;
}

/* Keep upload section centered and narrower for better UX */
.upload-section {
    max-width: 800px;
    margin: 0 auto 2rem auto;
}

.mapping-section {
    max-width: 1400px;
    margin: 0 auto 2rem auto;
}

/* Header */
.header {
    position: relative;
    text-align: center;
    margin-bottom: 3rem;
}

.logout-link {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
}
.logout-link:hover {
    text-decoration: underline;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: var(--h1-size);
    font-weight: var(--h1-weight);
    letter-spacing: var(--heading-letter-spacing);
    color: var(--text-primary);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.processor-nav-links {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}
.processor-nav-links a {
    color: var(--primary);
    text-decoration: none;
}
.processor-nav-links a:hover {
    text-decoration: underline;
}

/* Upload Section - defined above with max-width */

.drop-zone {
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.02);
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    transform: scale(1.01);
}

.drop-zone-content {
    pointer-events: none;
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.drop-zone h2 {
    font-family: var(--font-heading);
    font-size: var(--h2-size);
    font-weight: var(--h2-weight);
    letter-spacing: var(--heading-letter-spacing);
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.drop-zone p {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.commodity-ref-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}
.commodity-ref-hint label.link-style {
    cursor: pointer;
}

.file-types {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Section Headers */
.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: var(--h2-size);
    font-weight: var(--h2-weight);
    letter-spacing: var(--heading-letter-spacing);
    margin-bottom: 0.25rem;
}

.section-header p {
    color: var(--text-secondary);
}

/* Mapping Section */
.mapping-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.mapping-intro {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1.25rem 0;
    max-width: 640px;
}

.mapping-intro-badge {
    display: inline;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
    background: rgba(239, 68, 68, 0.12);
    color: var(--error);
}

.mapping-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 640px;
}

.mapping-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.mapping-item--no-suggestion {
    border-left: 3px solid var(--warning);
    background: rgba(245, 158, 11, 0.06);
}

/* Mapped: green highlight */
.mapping-item--mapped {
    border-left: 3px solid var(--success, #16a34a);
    background: rgba(22, 163, 74, 0.08);
}
.mapping-item--mapped.mapping-item--no-suggestion {
    border-left-color: var(--success, #16a34a);
    background: rgba(22, 163, 74, 0.08);
}

/* Required but empty: red highlight */
.mapping-item--required-empty {
    border-left: 3px solid var(--error);
    background: rgba(239, 68, 68, 0.08);
}

/* Optional but empty: orange highlight */
.mapping-item--optional-empty {
    border-left: 3px solid var(--warning);
    background: rgba(245, 158, 11, 0.08);
}

.mapping-item-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mapping-item label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin: 0;
}

.mapping-item.required label::after {
    content: ' *';
    color: var(--error);
}

.mapping-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.mapping-badge--required {
    background: rgba(239, 68, 68, 0.12);
    color: var(--error);
}

.mapping-badge--optional-some {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.mapping-badge--optional {
    background: var(--border);
    color: var(--text-muted);
}

.mapping-item .field-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: -0.1rem;
}

.mapping-item select {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mapping-item select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.mapping-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.mapping-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.mapping-hint--top {
    margin: 0 0 1rem 0;
}

.link-style {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}

.link-style:hover {
    color: var(--primary-dark);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-export {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.btn-export:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-success:hover {
    background: #059669;
}

/* Data Section - Full Width */
.data-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 100%;
}

.data-section-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.reporting-country-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.reporting-country-select {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    min-width: 180px;
}

/* Highlight countries that have data in the dropdown */
.reporting-country-select option.option-has-data {
    font-weight: 600;
    color: var(--primary);
}

.data-stats {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

/* Aggregated line overview */
.line-overview-panel {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.line-overview-title {
    font-size: 1rem;
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-weight: 600;
}

.line-overview-empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.line-overview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.line-overview-card {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 140px;
}

.line-overview-card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.line-overview-card-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.line-overview-tables {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.line-overview-block {
    min-width: 160px;
}

.line-overview-block h4 {
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.line-overview-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.line-overview-table td {
    padding: 0.25rem 0.5rem 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.line-overview-table td:last-child {
    text-align: right;
    font-weight: 500;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
    color: var(--primary);
}

/* Validation Panel */
.validation-panel {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.validation-panel.hidden {
    display: none;
}

.validation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
    font-weight: 600;
}

.validation-panel.success .validation-header {
    background: rgba(16, 185, 129, 0.1);
    border-bottom-color: rgba(16, 185, 129, 0.2);
}

.collapse-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

.validation-content {
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.validation-content.collapsed {
    display: none;
}

.validation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.validation-item:last-child {
    border-bottom: none;
}

.validation-item.error {
    color: var(--error);
}

.validation-item.warning {
    color: var(--warning);
}

.validation-item.info {
    color: var(--text-secondary);
}

/* Suggestions Panel */
.suggestions-panel {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.suggestions-panel.hidden {
    display: none;
}

.suggestions-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
    font-weight: 600;
}

.suggestions-icon {
    font-size: 1.25rem;
}

.suggestions-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.suggestions-content {
    padding: 1rem;
}

.suggestions-content.collapsed {
    display: none;
}

.suggestion-reporting-country {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius);
}

.suggestion-reporting-country--none {
    background: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.2);
}

.suggestion-reporting-country-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.suggestion-reporting-country strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.suggestion-reporting-country-detail {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.35rem 0;
    line-height: 1.45;
}

.suggestion-reporting-country-detail code {
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.suggestion-reporting-country-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.suggestions-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.suggestions-option-include-warnings {
    margin: 0.75rem 0 1rem 0;
    padding: 0.5rem 0;
}
.suggestions-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}
.suggestions-include-warnings-cb {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
}
.suggestions-option-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    margin-left: 1.75rem;
    line-height: 1.4;
}

.suggestions-summary {
    margin-top: 0.5rem;
}

.suggestions-field-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-field-count {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.suggestions-overview-intro {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
}

.suggestions-bulk-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.suggestion-bulk-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.suggestion-bulk-label {
    flex: 1;
    min-width: 180px;
    font-size: 0.875rem;
}

.suggestion-bulk-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.suggestion-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-apply-bulk {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-apply-bulk:hover {
    filter: brightness(1.05);
}

.btn-change-input {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-change-input:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.suggestion-bulk-edit-wrap {
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(16, 185, 129, 0.2);
}

.suggestion-bulk-edit {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-bulk-edit-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.suggestion-bulk-select,
.suggestion-bulk-input {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 140px;
}

.suggestion-bulk-input[type="number"] {
    min-width: 100px;
}

.btn-apply-bulk-custom {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-apply-bulk-custom:hover {
    filter: brightness(1.05);
}

/* Suggestion badges in table cells */
.suggestion-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.suggestion-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(37, 99, 235, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: default;
}

.suggestion-icon {
    font-size: 0.85rem;
}

.suggestion-value {
    font-weight: 600;
    color: var(--success);
}

.suggestion-reason {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.btn-accept-suggestion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    margin-left: 0.25rem;
    background: var(--success);
    border: none;
    border-radius: 3px;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accept-suggestion:hover {
    background: #059669;
    transform: scale(1.1);
}

.empty-value {
    color: var(--text-muted);
    font-style: italic;
}

.invalid-value {
    color: var(--error);
    text-decoration: line-through;
    opacity: 0.7;
}

.cell-editable.has-suggestion {
    background: rgba(16, 185, 129, 0.03);
}

/* CN Code validation states */
.cell-editable.cn-valid {
    position: relative;
}

.cell-editable.cn-valid::after {
    content: '✓';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--success);
    opacity: 0.7;
}

.cell-editable.cn-unknown {
    background: rgba(245, 158, 11, 0.05);
}

.cell-editable.cn-invalid {
    background: rgba(239, 68, 68, 0.08);
}

/* VAT validation states */
.cell-editable.vat-valid {
    position: relative;
}

.cell-editable.vat-valid::after {
    content: '✓';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--success);
    opacity: 0.7;
}

.cell-editable.vat-invalid {
    background: rgba(239, 68, 68, 0.08);
}

.cell-editable.vies-verified::after {
    content: '✓✓';
    color: #059669;
}

/* VIES verification link */
.vies-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
    margin-left: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.vies-link:hover {
    opacity: 1;
}

/* VIES Panel - Full Width Modern Design */
.vies-panel {
    background: linear-gradient(135deg, #1e40af 0%, #3730a3 50%, #4338ca 100%);
    border: none;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 10px 40px -10px rgba(37, 99, 235, 0.4);
}

.vies-panel.hidden {
    display: none;
}

.vies-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    font-weight: 600;
    color: white;
}

.vies-icon {
    font-size: 1.5rem;
}

.vies-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.vies-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 400;
}

.vies-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.vies-actions .btn-primary {
    background: white;
    color: var(--primary);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.vies-actions .btn-primary:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.vies-actions .collapse-btn {
    color: white;
    opacity: 0.8;
}

.vies-actions .collapse-btn:hover {
    opacity: 1;
}

.vies-content {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
}

.vies-content.collapsed {
    display: none;
}

.vies-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.vies-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

/* VIES Progress bar - Modern */
.vies-progress {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.vies-progress p {
    margin: 0;
    color: var(--text-primary);
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin: 0.75rem 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #10b981, #06b6d4);
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

#viesProgressText {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.75rem 0 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* VIES Results Grid */
.vies-results,
#viesResultsList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem;
}

.vies-result-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.vies-result-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.vies-result-item.valid {
    border-left: 4px solid var(--success);
    color: var(--text-primary);
}

.vies-result-item.invalid {
    border-left: 4px solid var(--error);
    color: var(--text-primary);
}

.vies-result-item.error {
    border-left: 4px solid var(--warning);
    color: var(--text-primary);
}

.vies-result-item > span:first-child {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.vies-result-item.valid > span:first-child {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.vies-result-item.invalid > span:first-child {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.vies-result-item.error > span:first-child {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.vies-result-item > div {
    flex: 1;
    min-width: 0;
}

.vies-result-item strong {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.vies-result-item .company-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    line-height: 1.4;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

/* Verification complete summary */
.vies-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.vies-summary-item {
    text-align: center;
    padding: 0.75rem;
}

.vies-summary-item .count {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.vies-summary-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.vies-summary-item.valid .count {
    color: var(--success);
}

.vies-summary-item.invalid .count {
    color: var(--error);
}

.vies-summary-item.error .count {
    color: var(--warning);
}

/* Better tooltip for CN codes and VAT numbers */
.cell-editable[title] {
    cursor: help;
}

.cell-editable[title]:hover {
    position: relative;
}

.has-suggestions {
    background: rgba(16, 185, 129, 0.02) !important;
}

/* Accept all button in row */
.btn-accept-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-right: 0.5rem;
    background: transparent;
    border: 1px solid var(--success);
    border-radius: var(--radius);
    color: var(--success);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accept-all:hover {
    background: var(--success);
    color: white;
}

.btn-accept-all:active {
    transform: scale(0.95);
}

.btn-accept-all svg {
    pointer-events: none;
}

/* Line item tabs (Detailed / Aggregated / By reporting country) */
.line-item-tabs {
    margin-top: 1rem;
}

.tab-list {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
    padding-top: 0;
}

.tab-pane.active {
    display: block;
}

.tab-pane .table-container {
    margin-top: 0;
}

.empty-tab {
    text-align: center;
    padding: 2rem 1rem !important;
    color: var(--text-muted);
    font-style: italic;
}

/* Table - Compact, fit all columns on one screen */
.table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 100%;
}

.data-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: auto;
}

.data-table th {
    background: var(--bg-tertiary);
    padding: 0.4rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.data-table th[title] {
    cursor: help;
}

.data-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.data-table tr:hover {
    background: var(--bg-tertiary);
}

.data-table tr.error-row {
    background: rgba(239, 68, 68, 0.05);
}

.data-table tr.warning-row {
    background: rgba(245, 158, 11, 0.05);
}

.cell-error {
    color: var(--error);
    font-weight: 600;
}

.cell-warning {
    color: var(--warning);
}

.cell-editable {
    cursor: pointer;
    position: relative;
}

.cell-editable:hover {
    background: rgba(37, 99, 235, 0.05);
}

.cell-editable input,
.cell-editable select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    background: var(--bg-secondary);
}

.cell-editable select {
    min-width: 180px;
    cursor: pointer;
}

.cell-editable.has-dropdown {
    cursor: pointer;
}

.cell-editable.has-dropdown:hover::after {
    content: '▼';
    font-size: 0.6rem;
    margin-left: 0.5rem;
    color: var(--text-muted);
}

/* Actions Column */
.actions-col {
    width: 70px;
    text-align: center;
}

.actions-cell {
    text-align: center;
    padding: 0.5rem !important;
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.btn-delete:active {
    transform: scale(0.95);
}

.btn-delete svg {
    pointer-events: none;
}

.data-table th.row-number,
.data-table td.row-number {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bg-secondary);
    box-shadow: 1px 0 0 var(--border);
}

.data-table th.row-number {
    background: var(--bg-tertiary);
    z-index: 2;
}

.row-number {
    color: var(--text-muted);
    font-size: 0.75rem;
    width: 2.5rem;
    min-width: 2.5rem;
    text-align: right;
    padding-right: 0.5rem !important;
}

/* Export Section */
.export-section {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.export-section h3 {
    font-family: var(--font-heading);
    font-size: var(--h3-size);
    font-weight: var(--h3-weight);
    letter-spacing: var(--heading-letter-spacing);
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.export-note {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    max-width: 56rem;
}

.export-note a {
    color: var(--primary);
    text-decoration: underline;
}

.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* New File Section */
.new-file-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* Footer */
.footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.disclaimer {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Submission options modal */
.btn-link {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}
.btn-link:hover { color: var(--primary-dark); }

.submission-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}
.submission-modal-overlay.hidden { display: none; }

.submission-modal-dialog {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 520px;
    width: 100%;
    padding: 1.5rem;
    position: relative;
}
.submission-modal-dialog h3 {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
}
.submission-modal-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
    line-height: 1.5;
}
.submission-modal-country {
    margin-bottom: 1rem;
}
.submission-modal-country label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}
.submission-modal-country select {
    width: 100%;
    max-width: 280px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.submission-modal-detail {
    margin-bottom: 1rem;
}
.submission-modal-method {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
}
.submission-portal-btn {
    display: inline-block;
    margin-bottom: 0.75rem;
    text-decoration: none;
}
.submission-modal-credentials {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}
.submission-modal-full-ref {
    font-size: 0.85rem;
    margin: 0;
}
.submission-modal-full-ref a { color: var(--primary); }
.submission-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius);
}
.submission-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Proceed to submission step */
.submission-step-section {
    margin-top: 2rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.submission-step-section h3 { margin: 0 0 0.5rem; }
.submission-step-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
    line-height: 1.45;
}
.submission-step-section .btn-primary {
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}
.submission-step-section .btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}
.submission-step-section .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.submission-step-error-note {
    font-size: 0.875rem;
    color: var(--error);
    margin: 0.75rem 0 0;
}
.submission-step-error-note.hidden { display: none; }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
    max-width: 90%;
}

.loading-overlay-message {
    margin: 0 0 1rem;
    font-weight: 500;
    color: var(--text);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-progress-track {
    width: 200px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 40%;
    min-width: 40px;
    background: var(--primary);
    border-radius: 3px;
    animation: loading-progress-shimmer 1.2s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes loading-progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .upload-section,
    .mapping-section {
        max-width: 100%;
    }
    
    .logo h1 {
        font-size: calc(var(--h1-size) * 0.75);
    }
    
    .drop-zone {
        padding: 2rem 1rem;
    }
    
    .mapping-grid {
        max-width: 100%;
    }
    
    .data-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .btn-export {
        width: 100%;
    }
    
    .vies-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .vies-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: white;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}
