body {
    font-family: var(--tools-font-family, Arial, sans-serif);
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

.container {
    max-width: var(--tools-container-max-width, 90%);
    margin: 50px auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

h1,
h2 {
    text-align: center;
}

p {
    font-size: 14px;
    color: #555;
}

label {
    font-weight: bold;
}

input,
select,
button {
    width: 100%;
    padding: 8px;
    margin: 5px 0 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

button {
    background-color: #0069d9;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    user-select: none;
}

button:hover {
    background-color: #0056b3;
}

#statusMessage {
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    background-color: #e9f5ff;
    border-left: 5px solid #007bff;
}

.status-message-label {
    margin: 0 0 8px;
    color: #0f172a;
    text-align: left;
}

.status-message-progress {
    display: block;
    width: 100%;
    height: 16px;
    margin: 0;
    border: 1px solid #dbeafe;
    border-radius: 4px;
    background-color: #eff6ff;
    color: #93c5fd;
    vertical-align: middle;
}

.status-message-progress::-webkit-progress-bar {
    background-color: #eff6ff;
    border-radius: 4px;
}

.status-message-progress::-webkit-progress-value {
    background-color: #bfdbfe;
    border-radius: 4px;
}

.status-message-progress::-moz-progress-bar {
    background-color: #bfdbfe;
    border-radius: 4px;
}

.file-drop-zone {
    margin: 8px 0 16px;
    padding: 24px 20px;
    border: 2px dashed #93c5fd;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f7ff 100%);
    text-align: center;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.file-drop-zone:hover,
.file-drop-zone:focus-visible,
.file-drop-zone.drag-over {
    border-color: #2563eb;
    background: #e8f1ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.file-drop-zone-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e3a8a;
    text-align: center;
}

.file-drop-zone-subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    color: #334155;
    text-align: center;
}

.file-drop-zone-file {
    margin: 10px 0 0;
    font-size: 13px;
    color: #0f172a;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
}

.file-input-hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.meta-tag.level {
    background: #e8f5e9;
    border-left-color: #66bb6a;
    color: #1b5e20;
}

.ilr-flag-icons {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
}

.ilr-flag-icon {
    font-size: 0.82rem;
    line-height: 1;
}

.ilr-flag-label {
    font-weight: normal;
}

.meta-tag.ilr-flag-tag.flag-english {
    background: #eaf1ff;
    border-left-color: #4a7de8;
    color: #1e3a8a;
}

.meta-tag.ilr-flag-tag.flag-maths {
    background: #fff4e6;
    border-left-color: #e8a027;
    color: #7a4a00;
}

.meta-tag.ilr-flag-tag.flag-esol {
    background: #e8f7f0;
    border-left-color: #28a77a;
    color: #155a3f;
}

.meta-tag.ilr-flag-tag.flag-impacts-funding {
    background: #edf8ef;
    border-left-color: #28a745;
    color: #155724;
}

.upload-option {
    margin: 15px 0;
}

.upload-option input[type='checkbox'] {
    width: auto;
    margin-right: 8px;
}

.upload-option label {
    font-weight: normal;
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table th,
table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

table th {
    background-color: #333;
    color: #fff;
    font-weight: bold;
    position: relative;
}

tr.alternate {
    background-color: #f2f2f2;
}

.unchanged-value {
    color: #6b7280;
}

.result-detail-section {
    margin-block: 1.5rem;
}

.result-detail-section > summary {
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.result-detail-section[open] > summary {
    margin-bottom: 0.5rem;
}

.result-detail-section > summary h2,
.result-detail-section > summary h3 {
    display: inline;
    font-size: inherit;
    margin: 0;
}

#error {
    color: darkred;
    background-color: #ffe5e5;
    font-weight: bold;
    margin: 10px 0;
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    border-left: 5px solid darkred;
}

.ilr-table-filter-summary {
    margin: 12px 0 8px;
    padding: 10px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
}

.ilr-table-filter-summary-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #1e3a8a;
}

.ilr-table-filter-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.ilr-table-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #93c5fd;
    background: #e0f2fe;
    color: #0f172a;
    font-size: 12px;
}

.ilr-table-filter-chip-clear,
.ilr-table-order-chip-clear,
.ilr-table-filter-clear-all,
.ilr-table-filter-popup-action,
.ilr-table-filter-trigger,
.ilr-table-order-trigger {
    width: auto;
    margin: 0;
    padding: 4px 8px;
    border: 1px solid #60a5fa;
    border-radius: 4px;
    background: #fff;
    color: #1d4ed8;
    font-size: 12px;
    cursor: pointer;
}

table th:has(.ilr-table-filter-control) {
    position: relative;
    padding-right: 72px;
}

.ilr-table-filter-control {
    display: inline-flex;
    gap: 4px;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.ilr-table-filter-trigger,
.ilr-table-order-trigger {
    margin-left: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
}

.ilr-table-filter-trigger.active,
.ilr-table-order-trigger.active {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
}

.ilr-table-filter-popup {
    position: absolute;
    z-index: 1000;
    width: min(320px, calc(100vw - 16px));
    max-height: 340px;
    overflow: auto;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.ilr-table-filter-popup-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.ilr-table-filter-select-all-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.ilr-table-filter-option-list {
    max-height: 220px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px;
    margin-bottom: 8px;
}

.ilr-table-filter-option {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 0;
    font-weight: 400;
    color: #0f172a;
}

.ilr-table-filter-option input[type='checkbox'] {
    width: auto;
    margin: 0;
}

.ilr-table-filter-option-section-title {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.ilr-table-flag-filter-option-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.flag-filter-label.ilr-table-flag-filter-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    margin: 0;
    padding: 5px 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 400;
    user-select: none;
    transition:
        background 0.15s,
        border-color 0.15s;
}

.flag-filter-label.ilr-table-flag-filter-option:hover {
    background: #f0f4ff;
    border-color: #2563eb;
}

.flag-filter-label.ilr-table-flag-filter-option input[type='checkbox'] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #2563eb;
    cursor: pointer;
}

.flag-filter-label.ilr-table-flag-filter-option:has(input:checked) {
    background: #e8f0fe;
    border-color: #2563eb;
    font-weight: 600;
}

.ilr-table-filter-popup-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ilr-summary-drilldown-menu {
    width: min(260px, calc(100vw - 16px));
    max-height: none;
}

.ilr-summary-drilldown-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ilr-summary-drilldown-menu-action {
    width: 100%;
    text-align: left;
}

table td:has(.ilr-summary-drilldown-control) {
    position: relative;
    padding-right: 60px;
}

.ilr-summary-drilldown-control {
    display: inline-flex;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

.ilr-summary-drilldown-trigger {
    width: auto;
    margin: 0;
    padding: 2px 6px;
    border: 1px solid #60a5fa;
    border-radius: 4px;
    background: #fff;
    color: #1d4ed8;
    font-size: 11px;
    cursor: pointer;
}

.ilr-summary-drilldown-trigger:focus,
.ilr-summary-drilldown-trigger:hover {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    z-index: 1001;
    padding: 8px 12px;
    background: #0f172a;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 8px;
}

.ilr-table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.ilr-table-scroll-wrapper table {
    min-width: 100%;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 14mm 12mm 18mm;
    }

    body {
        background: #fff;
        color: #000;
        counter-reset: page;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .result-detail-section {
        display: block;
    }

    .result-detail-section:not([open]) > *:not(summary) {
        display: block !important;
    }

    .result-detail-section > summary {
        list-style: none;
    }

    .result-detail-section > summary::-webkit-details-marker {
        display: none;
    }

    .file-drop-zone,
    .file-drop-zone-subtitle,
    .upload-option,
    input,
    select,
    button,
    progress,
    label[for='fileInput'],
    #statusMessage {
        display: none !important;
    }

    h1 {
        break-before: page;
        page-break-before: always;
        margin-top: 0;
    }

    table {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
        background-image: none !important;
    }

    body::after {
        content: counter(page);
        position: fixed;
        bottom: 6mm;
        left: 50%;
        transform: translateX(-50%);
        font-size: 11px;
        color: #4b5563;
    }
}
