body {
    box-sizing: border-box;
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #242628;
}

#resultImageContainer {
    color: #fff;
    display: inline-block;
    position: relative;
}

#resultImageContainer .remove-button {
    font-size: inherit;
    position: absolute;
    background-color: rgb(148, 0, 0);
    color: #fff;
    border: none;
    cursor: pointer;
}

#resultImageContainer img {
    max-width: 100%;
}

.text-number {
    position: absolute;
    background-color: black;
    padding: 2px;
}

.loading {
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 16, 17, 0.85);
    backdrop-filter: blur(4px);
    color: #fff;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #6ea8fe;
    animation: header-spin 0.8s linear infinite;
}

@keyframes header-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Top toolbar: group/column selects + primary actions */

.control-panel {
    background: #2a2d30;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #e8e9eb;
}

.control-panel-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.control-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #a9adb2;
}

.control-select.form-select {
    background-color: #1f2225;
    color: #e8e9eb;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a9adb2' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.control-select.form-select:focus {
    border-color: #6ea8fe;
    box-shadow: 0 0 0 0.2rem rgba(110, 168, 254, 0.25);
}

.control-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

@media (max-width: 576px) {
    .control-panel-actions {
        flex-direction: column;
    }

    .control-panel-actions .action-btn,
    .control-panel-actions .header-edit-trigger {
        width: 100%;
        justify-content: center;
    }
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.action-btn-primary {
    background: #0d6efd;
    color: #fff;
}

.action-btn-primary:hover,
.action-btn-primary:focus-visible {
    background: #3d8bfd;
    color: #fff;
}

.action-btn-danger {
    background: transparent;
    border-color: rgba(255, 138, 138, 0.4);
    color: #ff8a8a;
}

.action-btn-danger:hover,
.action-btn-danger:focus-visible {
    background: rgba(255, 138, 138, 0.12);
    border-color: #ff8a8a;
    color: #ff8a8a;
}

/* Manual ticket-number entry tray */

.unresolved-heading {
    color: #fff;
    margin: 1.5rem 0 0.15rem;
}

.unresolved-subtitle {
    color: #a9adb2;
    font-size: 0.85rem;
    margin: 0 0 1rem;
}

.unresolved-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .unresolved-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.unresolved-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #313538;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.75rem;
}

.unresolved-thumb {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    background: #1f2225;
    border-radius: 8px;
}

.unresolved-form {
    display: flex;
    gap: 0.4rem;
}

.unresolved-input {
    flex: 1;
    min-width: 0;
    background-color: #1f2225;
    color: #e8e9eb;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    font-size: 0.9rem;
}

.unresolved-input:focus {
    outline: none;
    border-color: #6ea8fe;
    box-shadow: 0 0 0 0.2rem rgba(110, 168, 254, 0.25);
}

.unresolved-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    border-radius: 8px;
    border: none;
    background: #0d6efd;
    color: #fff;
    transition: background-color 0.15s ease;
}

.unresolved-submit:hover,
.unresolved-submit:focus-visible {
    background: #3d8bfd;
}

/* Empty-state placeholder before any tickets are uploaded */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    color: #a9adb2;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: #565a5e;
}

.empty-state-text {
    color: #e8e9eb;
    font-size: 1rem;
    margin: 0;
}

.empty-state-version {
    font-size: 0.8rem;
    color: #6b6f73;
    margin: 0;
}

.header-icon {
    width: 18px;
    height: 18px;
    flex: none;
}

.header-edit-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: #e8e9eb;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.header-edit-trigger:hover,
.header-edit-trigger:focus-visible {
    border-color: #6ea8fe;
    background: rgba(110, 168, 254, 0.12);
    color: #fff;
}

.header-manager-modal {
    background: #2a2d30;
    color: #e8e9eb;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.header-manager-modal .modal-header,
.header-manager-modal .modal-footer {
    border-color: rgba(255, 255, 255, 0.08);
}

.header-manager-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: #a9adb2;
}

.header-manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.header-tile {
    background: #313538;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.header-tile:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.header-tile.is-custom {
    border-color: #6ea8fe;
}

.header-tile-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 88px;
    background: repeating-conic-gradient(#26292c 0% 25%, #2c2f32 0% 50%) 50% / 16px 16px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.header-tile-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.header-tile-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.header-tile-error {
    min-height: 1.1em;
    margin: 0 0 0.3rem;
    font-size: 0.75rem;
    color: #ff8a8a;
}

.header-tile-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.header-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    background: #0d6efd;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.header-upload-btn:hover {
    background: #3d8bfd;
}

.header-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: #a9adb2;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.header-reset-btn:hover:not(:disabled),
.header-reset-btn:focus-visible:not(:disabled) {
    border-color: #ff8a8a;
    color: #ff8a8a;
    background: rgba(255, 138, 138, 0.1);
}

.header-reset-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/*
.loading span {
    animation: loading .5s infinite;
}

@keyframes loading {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
} */